Skip to content

Commit

Permalink
feat: 버튼 컴포넌트 및 스타일 작성
Browse files Browse the repository at this point in the history
  • Loading branch information
miro-ring committed Jan 6, 2024
1 parent 4a2b4c2 commit 03f2128
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/components/Button/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import type { ComponentPropsWithoutRef, PropsWithChildren } from 'react';
import type { RecipeVariants } from '@vanilla-extract/recipes';
import clsx from 'clsx';

import * as styles from './style.css';

interface ButtonProps
extends RecipeVariants<typeof styles.button>,
PropsWithChildren<ComponentPropsWithoutRef<'button'>> {
onClick: () => void;
}

const Button = ({ children, className, size, state, onClick }: ButtonProps) => {
return (
<button
className={clsx(styles.button({ state, size }), className)}
type="button"
onClick={onClick}
>
{children}
</button>
);
};

export default Button;
40 changes: 40 additions & 0 deletions src/components/Button/style.css.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { recipe } from '@vanilla-extract/recipes';

import { sprinkles } from '@/src/styles/sprinkles.css';
import { COLORS } from '@/src/styles/tokens';

export const button = recipe({
variants: {
state: {
default: {
backgroundColor: COLORS['Grey/150'],
color: COLORS['Grey/600'],
},
disabled: {
backgroundColor: COLORS['Blue/Default'],
color: COLORS['Grey/White'],
opacity: '50%',
},
enabled: {
backgroundColor: COLORS['Blue/Default'],
color: COLORS['Grey/White'],
},
},
size: {
M: [
sprinkles({ typography: '15/Title/Medium' }),
{
padding: '15px 24px',
borderRadius: '8px',
},
],
L: [
sprinkles({ typography: '16/Title/Medium' }),
{
padding: '18.5px 40px',
borderRadius: '8px',
},
],
},
},
});

0 comments on commit 03f2128

Please sign in to comment.