Skip to content

Commit

Permalink
DS-5 - Switch updates
Browse files Browse the repository at this point in the history
  • Loading branch information
AlejoYarce committed Oct 23, 2024
1 parent 5c65117 commit e71ece1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/components/Switch/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,16 @@ const Switch = ({
) : null}
<SwitchContent>
{!isDisabled ? <SwitchIconHover className='switch-icon-hover' /> : null}
{isLocalChecked && !isDisabled ? (
<SwitchIconContainer>
<SwitchIconContainer
className={isLocalChecked && !isDisabled ? 'move-me' : ''}
>
{isLocalChecked && !isDisabled ? (
<SwitchIcon
onClick={handleOnIconClick}
color={getThemedColor(theme.colors, 'primary', 700)}
/>
</SwitchIconContainer>
) : null}
) : null}
</SwitchIconContainer>
<ChakraSwitch
id={id}
aria-label={label || rest['aria-label']}
Expand Down
10 changes: 10 additions & 0 deletions src/components/Switch/styled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,16 @@ export const SwitchIconContainer = styled.div`
justify-content: center;
align-items: center;
cursor: pointer;
transform: translateX(-18px);
transition-property: transform;
transition-duration: 200ms;
&.move-me {
transform: translateX(0px);
transition-property: transform;
transition-duration: 100ms;
}
`

export const SwitchIcon = styled(CheckIcon)`
Expand Down

0 comments on commit e71ece1

Please sign in to comment.