diff --git a/packages/default-icons/src/figma-icons/FavAdded16.tsx b/packages/default-icons/src/figma-icons/FavAdded16.tsx new file mode 100644 index 00000000..25304d26 --- /dev/null +++ b/packages/default-icons/src/figma-icons/FavAdded16.tsx @@ -0,0 +1,16 @@ +import { SVGProps, memo } from 'react'; + +const FavAdded16 = (props: SVGProps) => ( + + + +); + +FavAdded16.displayName = 'FavAdded16'; +const Memo = memo(FavAdded16); +export default Memo; diff --git a/packages/default-icons/src/figma-icons/index.ts b/packages/default-icons/src/figma-icons/index.ts index ee24c799..664623fb 100644 --- a/packages/default-icons/src/figma-icons/index.ts +++ b/packages/default-icons/src/figma-icons/index.ts @@ -180,3 +180,4 @@ export { default as Reference16 } from './Reference16'; export { default as Rubber16 } from './Rubber16'; export { default as Rubber24 } from './Rubber24'; export { default as Diamond24 } from './Diamond24'; +export { default as FavAdded16 } from './FavAdded16'; diff --git a/packages/ui-kit/src/Toggler/Toggler.fixture.style.module.css b/packages/ui-kit/src/Toggler/Toggler.fixture.style.module.css new file mode 100644 index 00000000..e2651546 --- /dev/null +++ b/packages/ui-kit/src/Toggler/Toggler.fixture.style.module.css @@ -0,0 +1,10 @@ +.label { + font-weight: 600; + font-size: 16px; + line-height: 20px; + color: var(--faint-strong-up); + + &.active { + color: var(--base-strong); + } +} diff --git a/packages/ui-kit/src/Toggler/Toggler.fixture.tsx b/packages/ui-kit/src/Toggler/Toggler.fixture.tsx index 2d756b70..a931703c 100644 --- a/packages/ui-kit/src/Toggler/Toggler.fixture.tsx +++ b/packages/ui-kit/src/Toggler/Toggler.fixture.tsx @@ -1,4 +1,5 @@ import { useCallback, useState } from 'react'; +import s from './Toggler.fixture.style.module.css'; import { Toggler } from '.'; export default { @@ -16,10 +17,15 @@ export default { foo: false, bar: true, baz: false, + isAnnualPayment: false, }); const onChange = useCallback((e: React.ChangeEvent) => { - setState((state) => ((state[e.target.id] = e.target.checked), { ...state })); + const { id, checked } = e.target; + setState((prevState) => ({ + ...prevState, + [id]: checked, + })); }, []); return ( @@ -27,6 +33,17 @@ export default { + {JSON.stringify(state, null, 2)} ); diff --git a/packages/ui-kit/src/Toggler/index.tsx b/packages/ui-kit/src/Toggler/index.tsx index 6a93d219..9c75bd2a 100644 --- a/packages/ui-kit/src/Toggler/index.tsx +++ b/packages/ui-kit/src/Toggler/index.tsx @@ -5,7 +5,12 @@ import type { ChangeEvent } from 'react'; interface Toggler { id: string; name?: string; - label?: React.ReactChild | React.ReactChild[]; + label?: React.ReactNode; + offValueLabel?: React.ReactNode; + classes?: { + label?: string; + activeLabel?: string; + }; className?: string; onChange?: (e: ChangeEvent) => void; on?: boolean; @@ -14,17 +19,28 @@ interface Toggler { export function Toggler({ name, label, + offValueLabel, className = '', + classes, id, on = false, ...native }: Toggler & React.DetailedHTMLProps, HTMLInputElement>): React.ReactElement { return ( -