11import React , { type HTMLAttributes } from "react" ;
22import { css , cva } from "../../../styled-system/css" ;
3- import type { SystemStyleObject } from "@pandacss/types " ;
3+ import type { Tone } from "../../tokens/colors " ;
44
55type ButtonVariant = "solid" | "outline" ;
6- type ButtonTone = "neutral" | "accent" | "danger" | "warning" ;
7- type ButtonSize = "small" | "medium" | "large" ;
6+ type ButtonSize = "sm" | "md" | "lg" ;
87
98export interface ButtonProps
109 extends Omit < HTMLAttributes < HTMLElement > , "style" > {
@@ -17,20 +16,18 @@ export interface ButtonProps
1716 /** 종류 */
1817 variant : ButtonVariant ;
1918 /** 색조 */
20- tone ?: ButtonTone ;
19+ tone ?: Tone ;
2120 /** 버튼의 크기 */
2221 size ?: ButtonSize ;
23- /** 추가 스타일 */
24- style ?: SystemStyleObject ;
2522 /** 버튼 비활성화 여부 */
2623 disabled ?: boolean ;
2724}
2825
2926/**
30- * - `variant` 속성으로 버튼의 스타일 종류를 지정할 수 있습니다. (solid, outline)
31- * - `tone` 속성으로 버튼의 색상 강조를 지정할 수 있습니다. (neutral, accent, danger, warning)
32- * - `size` 속성으로 버튼의 크기를 지정할 수 있습니다. (small, medium, large)
33- * - `type` 속성으로 버튼의 타입을 지정할 수 있습니다. (button, submit)
27+ * - `variant` 속성으로 버튼의 스타일 종류를 지정할 수 있습니다.
28+ * - `tone` 속성으로 버튼의 색상 강조를 지정할 수 있습니다.
29+ * - `size` 속성으로 버튼의 크기를 지정할 수 있습니다.
30+ * - `type` 속성으로 버튼의 타입을 지정할 수 있습니다.
3431 * - `disabled` 속성을 사용하여 버튼을 비활성화할 수 있습니다.
3532 */
3633export const Button = ( {
@@ -39,18 +36,13 @@ export const Button = ({
3936 onClick,
4037 variant = "solid" ,
4138 tone = "neutral" ,
42- style,
43- size = "medium" ,
39+ size = "md" ,
4440 disabled,
4541 ...rest
4642} : ButtonProps ) => {
4743 return (
4844 < button
49- className = { css (
50- styles . raw ( { tone, variant, size } ) ,
51- baseStyles ,
52- ...( Array . isArray ( style ) ? style : [ style ] )
53- ) }
45+ className = { css ( styles . raw ( { tone, variant, size } ) , baseStyles ) }
5446 type = { type }
5547 onClick = { onClick }
5648 disabled = { disabled }
@@ -88,15 +80,15 @@ const styles = cva({
8880 } ,
8981 variants : {
9082 size : {
91- small : {
83+ sm : {
9284 padding : "0.5rem 1.5rem" ,
9385 fontSize : "sm" ,
9486 } ,
95- medium : {
87+ md : {
9688 padding : "0.7rem 2rem" ,
9789 fontSize : "md" ,
9890 } ,
99- large : {
91+ lg : {
10092 padding : "1rem 2.5rem" ,
10193 fontSize : "lg" ,
10294 } ,
@@ -183,7 +175,7 @@ const styles = cva({
183175 css : {
184176 border : "3px solid" ,
185177 borderColor : "border" ,
186- color : "text.DEFAULT.base " ,
178+ color : "text" ,
187179 "&:active, &:hover" : {
188180 background : "bg.hover" ,
189181 color : "text.muted" ,
@@ -201,7 +193,7 @@ const styles = cva({
201193 css : {
202194 border : "3px solid" ,
203195 borderColor : "border.accent" ,
204- color : "text.accent.base " ,
196+ color : "text.accent" ,
205197 "&:active, &:hover" : {
206198 background : "bg.hover.accent" ,
207199 color : "text.muted.accent" ,
@@ -219,7 +211,7 @@ const styles = cva({
219211 css : {
220212 border : "3px solid" ,
221213 borderColor : "border.danger" ,
222- color : "text.danger.base " ,
214+ color : "text.danger" ,
223215 "&:active, &:hover" : {
224216 background : "bg.hover.danger" ,
225217 color : "text.muted.danger" ,
@@ -237,7 +229,7 @@ const styles = cva({
237229 css : {
238230 border : "3px solid" ,
239231 borderColor : "border.warning" ,
240- color : "text.warning.base " ,
232+ color : "text.warning" ,
241233 "&:active, &:hover" : {
242234 background : "bg.hover.warning" ,
243235 color : "text.muted.warning" ,
0 commit comments