diff --git a/src/components/common/toggle/Toggle.tsx b/src/components/common/toggle/Toggle.tsx index a8f1189..b6f8110 100644 --- a/src/components/common/toggle/Toggle.tsx +++ b/src/components/common/toggle/Toggle.tsx @@ -1,14 +1,11 @@ -'use client' - -import * as Switch from '@radix-ui/react-switch' -import { theme } from '@/styles/theme' -import styled from 'styled-components' +import ToggleRoot from './ToggleRoot' +import ToggleThumb from './ToggleThumb' const Toggle = () => { return ( - - - + + + ) } diff --git a/src/components/common/toggle/ToggleRoot.tsx b/src/components/common/toggle/ToggleRoot.tsx new file mode 100644 index 0000000..ded62b3 --- /dev/null +++ b/src/components/common/toggle/ToggleRoot.tsx @@ -0,0 +1,24 @@ +'use client' + +import * as Switch from '@radix-ui/react-switch' +import { theme } from '@/styles/theme' +import styled from 'styled-components' + +const StyledRoot = styled(Switch.Root)` + width: 42px; + height: 25px; + background-color: ${theme.color.grey200}; + border-radius: 9999px; + position: relative; + -webkit-tap-highlight-color: rgba(0, 0, 0, 0); + + &[data-state='checked'] { + background-color: ${theme.color.purple700}; + } +` + +const ToggleRoot = ({ children, ...props }: Switch.PrimitiveButtonProps) => { + return {children} +} + +export default ToggleRoot diff --git a/src/components/common/toggle/ToggleThumb.tsx b/src/components/common/toggle/ToggleThumb.tsx new file mode 100644 index 0000000..49b6104 --- /dev/null +++ b/src/components/common/toggle/ToggleThumb.tsx @@ -0,0 +1,27 @@ +'use client' + +import * as Switch from '@radix-ui/react-switch' +import { theme } from '@/styles/theme' +import styled from 'styled-components' + +const StyledThumb = styled(Switch.SwitchThumb)` + display: block; + width: 21px; + height: 21px; + background-color: ${theme.color.white}; + border-radius: 9999px; + box-shadow: 0 2px 2px var(--black-a7); + transition: transform 300ms; + transform: translateX(2px); + will-change: transform; + + &[data-state='checked'] { + transform: translateX(19px); + } +` + +const ToggleThumb = ({ ...props }: Switch.SwitchThumbProps) => { + return +} + +export default ToggleThumb