-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4744 from HedvigInsurance/09-18-remove-old-Toggle…
…Card tech: Remove old ToggleCard component
- Loading branch information
Showing
5 changed files
with
38 additions
and
116 deletions.
There are no files selected for viewing
29 changes: 18 additions & 11 deletions
29
apps/store/src/components/Cancellation/AutoSwitchToggleCard.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,29 @@ | ||
import { useTranslation } from 'next-i18next' | ||
import { type ComponentProps } from 'react' | ||
import { Text } from 'ui' | ||
import { ToggleCard } from '@/components/ToggleCard/ToggleCard' | ||
import { ToggleCard } from 'ui' | ||
|
||
type Props = Omit<ComponentProps<typeof ToggleCard>, 'label'> & { | ||
type Props = ComponentProps<typeof ToggleCard.Root> & { | ||
companyName: string | ||
checked: boolean | ||
onCheckedChange?: (checked: boolean) => void | ||
} | ||
|
||
export const AutoSwitchToggleCard = ({ checked, companyName, ...props }: Props) => { | ||
export const AutoSwitchToggleCard = ({ | ||
companyName, | ||
checked, | ||
onCheckedChange, | ||
...props | ||
}: Props) => { | ||
const { t } = useTranslation('purchase-form') | ||
|
||
return ( | ||
<ToggleCard {...props} label={t('AUTO_SWITCH_FIELD_LABEL')} defaultChecked={checked}> | ||
{checked && ( | ||
<Text as="p" size="xs" color="textSecondary"> | ||
{t('AUTO_SWITCH_FIELD_MESSAGE', { COMPANY: companyName })} | ||
</Text> | ||
)} | ||
</ToggleCard> | ||
<ToggleCard.Root {...props}> | ||
<ToggleCard.Label>{t('AUTO_SWITCH_FIELD_LABEL')}</ToggleCard.Label> | ||
<ToggleCard.Switch checked={checked} onCheckedChange={onCheckedChange} /> | ||
|
||
<ToggleCard.Description> | ||
{t('AUTO_SWITCH_FIELD_MESSAGE', { COMPANY: companyName })} | ||
</ToggleCard.Description> | ||
</ToggleCard.Root> | ||
) | ||
} |
This file was deleted.
Oops, something went wrong.
24 changes: 0 additions & 24 deletions
24
apps/store/src/components/ToggleCard/ToggleCard.stories.tsx
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
32 changes: 20 additions & 12 deletions
32
apps/store/src/features/carDealership/ExtensionOfferToggle.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters