Skip to content

Commit a8e56a5

Browse files
authored
Feat: 공통 Button 컴포넌트 구현
Feat: 공통 Button 컴포넌트 구현
2 parents f5b5f11 + 66dd303 commit a8e56a5

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed

components/Button.tsx

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import React, { ReactNode, ButtonHTMLAttributes } from "react";
2+
3+
interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
4+
children: ReactNode;
5+
width?: string;
6+
height?: string;
7+
radius?: string;
8+
color?: "positive" | "negative";
9+
size?: string;
10+
}
11+
12+
const Button = ({
13+
children,
14+
width = "auto",
15+
height = "53px",
16+
radius = "8px",
17+
color = "positive",
18+
size = "18px",
19+
...props
20+
}: ButtonProps) => {
21+
const backgroundStyle =
22+
color === "positive"
23+
? "linear-gradient(90.99deg, #6D6AFE 0.12%, #6AE3FE 101.84%)"
24+
: "#FF5B56";
25+
26+
return (
27+
<button
28+
style={{
29+
width,
30+
height,
31+
borderRadius: radius,
32+
background: backgroundStyle,
33+
fontSize: size,
34+
}}
35+
className="flex justify-center items-center text-white font-[600] whitespace-nowrap hover:opacity-90"
36+
{...props}
37+
>
38+
{children}
39+
</button>
40+
);
41+
};
42+
43+
export default Button;

styles/globals.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
:root {
1414
--background: #ffffff;
15+
--white200: #f5f5f5;
1516
--black100: #000;
1617
--black200: #111322;
1718
--black300: #373740;

tailwind.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ const config: Config = {
2020
gray400: "var(--gray400)",
2121
gray500: "var(--gray500)",
2222
purple100: "var(--purple100)",
23+
white200: "var(--white200)",
2324
},
2425
screens: {
2526
sm: "375px",

0 commit comments

Comments
 (0)