File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed
Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change 1+ import { MouseEvent } from "react" ;
2+
3+ interface FormButtonProps {
4+ size : "sm" | "md" ;
5+ children : string ;
6+ selected ?: boolean ;
7+ onClick ?: ( e : MouseEvent < HTMLButtonElement > ) => void ;
8+ }
9+
10+ const FormButton = ( {
11+ size = "sm" ,
12+ selected = false ,
13+ children,
14+ onClick
15+ } : FormButtonProps ) => {
16+ const baseStyles = "flex justify-center items-center rounded-lg transition" ;
17+
18+ const sizeStyles =
19+ size === "sm" ? "min-w-[68px] w-auto h-[40px]" : "w-[72px] h-[72px]" ;
20+
21+ const fontSize =
22+ size === "md"
23+ ? "text-[var(--text-2xl)]"
24+ : selected
25+ ? "text-[16px]"
26+ : "text-[14px]" ;
27+
28+ const fontWeight =
29+ size === "md" ? "font-bold" : selected ? "font-bold" : "font-medium" ;
30+
31+ const backgroundColor = selected ? "bg-primary-pale" : "bg-white" ;
32+ const borderColor = selected ? "border-primary-light" : "border-gray-200" ;
33+ const fontColor = selected ? "text-primary-normal" : "text-gray-900" ;
34+
35+ return (
36+ < button
37+ className = { `${ baseStyles } ${ sizeStyles } ${ fontSize } ${ fontWeight } ${ backgroundColor } ${ borderColor } ${ fontColor } border` }
38+ onClick = { onClick }
39+ >
40+ { children }
41+ </ button >
42+ ) ;
43+ } ;
44+ export default FormButton ;
You can’t perform that action at this time.
0 commit comments