Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import React, { ButtonHTMLAttributes } from 'react';

import * as m from 'motion/react-m';

import { cn } from '@/lib/utils';

interface ToggleButtonProps extends Omit<ButtonProps, 'value'> {
value?: boolean;
}
Expand All @@ -29,7 +31,11 @@ interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
const Button = ({ children, ...props }: ButtonProps) => {
return (
<button
className='text-text-sm-semibold flex cursor-pointer flex-row items-center justify-between rounded-xl px-3 py-3 text-gray-700 transition-all duration-300 hover:bg-gray-50'
className={cn(
'text-text-sm-semibold flex cursor-pointer flex-row items-center justify-between rounded-xl px-3 py-3 text-gray-700', // basic
'hover:bg-gray-50', // hover
'transition-all duration-300', //animation
)}
{...props}
>
{children}
Expand All @@ -43,7 +49,14 @@ interface ToggleUIProps {

const ToggleUI = ({ value = false }: ToggleUIProps) => {
return (
<div className='bg-mint-500 flex h-5 w-9 cursor-pointer rounded-full p-0.5'>
<m.div
className={cn(
'h-5 w-9 cursor-pointer rounded-full p-0.5',
value && 'bg-mint-500',
!value && 'bg-gray-300',
'transition-colors duration-300',
)}
>
<m.div
className='bg-mono-white size-4 rounded-full'
animate={{ x: value ? 16 : 0 }}
Expand All @@ -53,6 +66,6 @@ const ToggleUI = ({ value = false }: ToggleUIProps) => {
bounce: 0.3,
}}
/>
</div>
</m.div>
);
};