Skip to content

Commit

Permalink
fix: make example data details expand correctly dataset form
Browse files Browse the repository at this point in the history
  • Loading branch information
hegeaal committed Jan 2, 2025
1 parent 6238d62 commit c456b23
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ type FormikDistribution = {
export const DistributionSection = ({ referenceDataEnv, searchEnv, openLicenses }: Props) => {
const { values, setFieldValue } = useFormikContext<Dataset>();
const [expandedIndex, setExpandedIndex] = useState<number | null>(null);
const [expandedIndexExampleData, setExpandedIndexExampleData] = useState<number | null>(null);

const getSelectedFileTypes = (): string[] => {
const distributionFormats = values.distribution?.map((val) => val.format) || [];
Expand Down Expand Up @@ -213,12 +214,12 @@ export const DistributionSection = ({ referenceDataEnv, searchEnv, openLicenses
<Button
variant='tertiary'
onClick={() => {
setExpandedIndex(expandedIndex === index ? null : index);
setExpandedIndexExampleData(expandedIndexExampleData === index ? null : index);
}}
className={styles.button}
size='sm'
>
{expandedIndex === index ? (
{expandedIndexExampleData === index ? (
<>
<ChevronUpIcon fontSize='1.3rem' />
{localization.seeLess}
Expand All @@ -233,7 +234,7 @@ export const DistributionSection = ({ referenceDataEnv, searchEnv, openLicenses
</div>
)}

{expandedIndex === index && (
{expandedIndexExampleData === index && (
<DistributionDetails
distribution={item}
searchEnv={searchEnv}
Expand Down

0 comments on commit c456b23

Please sign in to comment.