diff --git a/components/src/components/atoms/DynamicPopover/DynamicPopover.tsx b/components/src/components/atoms/DynamicPopover/DynamicPopover.tsx index 7c04a992..d9a61916 100644 --- a/components/src/components/atoms/DynamicPopover/DynamicPopover.tsx +++ b/components/src/components/atoms/DynamicPopover/DynamicPopover.tsx @@ -9,6 +9,7 @@ import { getValueForTransitionState } from './utils/getValueForTransitionState' import { container } from './style.css' import { debounce } from '../../../utils/debounce' import { useBreakPoints } from '@/src/hooks/useBreakpoints' +import type { TransitionDuration } from '@/src/tokens' export type DynamicPopoverSide = 'top' | 'right' | 'bottom' | 'left' @@ -57,7 +58,7 @@ export type DynamicPopoverProps = { /** Aligns the popover */ align?: DynamicPopoverAlignment /** The duration of the transition */ - transitionDuration?: number + transitionDuration?: TransitionDuration /** If this is not undefined, popover becomes externally controlled */ isOpen?: boolean /** Hides the overflow of the content */ @@ -140,9 +141,6 @@ const checkRectContainsPoint = ( ) } -const makeWidth = (width: number | string) => - typeof width === 'number' ? width : width - type PopoverBoxProps = { $state: TransitionState $translate: string @@ -151,7 +149,7 @@ type PopoverBoxProps = { $x: number $y: number // $isControlled: boolean - $transitionDuration: number + $transitionDuration: TransitionDuration $hideOverflow: boolean | undefined } @@ -199,7 +197,7 @@ const PopoverBox = React.forwardRef( 'transitionProperty', )} visibility={getValueForTransitionState($state.status, 'visibility')} - width={{ xs: makeWidth($mobileWidth), sm: makeWidth($width) }} + width={{ xs: $mobileWidth, sm: $width }} zIndex={999999} /> ), diff --git a/components/src/components/molecules/CurrencyToggle/CurrencyToggle.tsx b/components/src/components/molecules/CurrencyToggle/CurrencyToggle.tsx index 4371c389..0ec94159 100644 --- a/components/src/components/molecules/CurrencyToggle/CurrencyToggle.tsx +++ b/components/src/components/molecules/CurrencyToggle/CurrencyToggle.tsx @@ -45,7 +45,9 @@ const Label = ({ left="1/2" position="absolute" top="1/2" - transition="color 0.1s linear" + transitionProperty="color" + transitionDuration={100} + transitionTimingFunction="linear" width={getValuesForKnob($size, 'width')} /> ) @@ -74,7 +76,7 @@ const Slider = ({ $size, $color, ...props -}: BoxProps & { $size: Size, $color: Color }) => ( +}: { $size: Size, $color: Color }) => ( ) @@ -106,7 +108,7 @@ export const CurrencyToggle = React.forwardRef - +