From 8d4f8c65b28c05c31e3d02c82809583d7a4ba8b6 Mon Sep 17 00:00:00 2001 From: macintoshhelper <6757532+macintoshhelper@users.noreply.github.com> Date: Thu, 3 Oct 2024 19:00:21 +0400 Subject: [PATCH] fix: remove full modal prop that sets zero padding --- .../ExportSetsTab.tsx | 94 +++++++++---------- 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/packages/tokens-studio-for-figma/src/app/components/ManageStylesAndVariables/ExportSetsTab.tsx b/packages/tokens-studio-for-figma/src/app/components/ManageStylesAndVariables/ExportSetsTab.tsx index ae9451a55..2b1b8ff4c 100644 --- a/packages/tokens-studio-for-figma/src/app/components/ManageStylesAndVariables/ExportSetsTab.tsx +++ b/packages/tokens-studio-for-figma/src/app/components/ManageStylesAndVariables/ExportSetsTab.tsx @@ -1,7 +1,5 @@ import { FileDirectoryIcon } from '@primer/octicons-react'; -import { - Tabs, Stack, Heading, Button, -} from '@tokens-studio/ui'; +import { Tabs, Stack, Heading, Button } from '@tokens-studio/ui'; import React, { useMemo } from 'react'; import { useDispatch, useSelector, useStore } from 'react-redux'; import { useForm, Controller } from 'react-hook-form'; @@ -24,7 +22,13 @@ import { FormValues } from '../ManageThemesModal/CreateOrEditThemeForm'; import { TokenSetStatus } from '@/constants/TokenSetStatus'; import { ExportTokenSet } from '@/types/ExportTokenSet'; -export default function ExportSetsTab({ selectedSets, setSelectedSets }: { selectedSets: ExportTokenSet[], setSelectedSets: (sets: ExportTokenSet[]) => void }) { +export default function ExportSetsTab({ + selectedSets, + setSelectedSets, +}: { + selectedSets: ExportTokenSet[]; + setSelectedSets: (sets: ExportTokenSet[]) => void; +}) { const dispatch = useDispatch(); const closeOnboarding = React.useCallback(() => { dispatch.uiState.setOnboardingExplainerExportSets(false); @@ -35,13 +39,9 @@ export default function ExportSetsTab({ selectedSets, setSelectedSets }: { selec const store = useStore(); - const selectedTokenSets = React.useMemo(() => ( - usedTokenSetSelector(store.getState()) - ), [store]); + const selectedTokenSets = React.useMemo(() => usedTokenSetSelector(store.getState()), [store]); - const { - control, getValues, reset, - } = useForm({ + const { control, getValues, reset } = useForm({ defaultValues: { tokenSets: { ...selectedTokenSets }, }, @@ -70,37 +70,40 @@ export default function ExportSetsTab({ selectedSets, setSelectedSets }: { selec setPreviousSetSelection(getValues()); }, [getValues]); - const TokenSetThemeItemInput = React.useCallback((props: React.PropsWithChildren<{ item: TreeItem }>) => ( - ( - - )} - /> - ), [control]); - - const selectedEnabledSets = useMemo(() => selectedSets.filter((set) => set.status === TokenSetStatus.ENABLED), [selectedSets]); + const TokenSetThemeItemInput = React.useCallback( + (props: React.PropsWithChildren<{ item: TreeItem }>) => ( + } + /> + ), + [control], + ); + + const selectedEnabledSets = useMemo( + () => selectedSets.filter((set) => set.status === TokenSetStatus.ENABLED), + [selectedSets], + ); React.useEffect(() => { if (!showChangeSets) { const currentSelectedSets = getValues(); - const internalSelectedTokenSets: ExportTokenSet[] = Object.keys(currentSelectedSets.tokenSets).reduce((acc: ExportTokenSet[], curr: string) => { - if (currentSelectedSets.tokenSets[curr] !== TokenSetStatus.DISABLED) { - const tokenSet = { - set: curr, - status: currentSelectedSets.tokenSets[curr], - } as ExportTokenSet; - acc.push(tokenSet); - } - return acc; - }, [] as ExportTokenSet[]); + const internalSelectedTokenSets: ExportTokenSet[] = Object.keys(currentSelectedSets.tokenSets).reduce( + (acc: ExportTokenSet[], curr: string) => { + if (currentSelectedSets.tokenSets[curr] !== TokenSetStatus.DISABLED) { + const tokenSet = { + set: curr, + status: currentSelectedSets.tokenSets[curr], + } as ExportTokenSet; + acc.push(tokenSet); + } + return acc; + }, + [] as ExportTokenSet[], + ); setSelectedSets([...internalSelectedTokenSets]); } }, [showChangeSets, getValues, setSelectedSets]); @@ -134,23 +137,22 @@ export default function ExportSetsTab({ selectedSets, setSelectedSets }: { selec {selectedEnabledSets.length} {' of '} - {allSets.length} - {' '} - {t('exportSetsTab.setsSelectedForExport')} + {allSets.length} {t('exportSetsTab.setsSelectedForExport')} - + - )} + } > - - {t('exportSetsTab.changeSetsHeading')} - + {t('exportSetsTab.changeSetsHeading')} {/* Commenting until we have docs {`${t('generic.learnMore')} – ${t('docs.referenceOnlyMode')}`} */}