Skip to content

Commit ba61d37

Browse files
committed
refactor: 버튼 스타일 수정, storybook global scss 적용
1 parent e9d9153 commit ba61d37

File tree

9 files changed

+24
-10
lines changed

9 files changed

+24
-10
lines changed

.storybook/preview.module.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
body {
2+
max-width: initial;
3+
}
4+
15
.Wrapper {
26
display: flex;
37
flex-flow: row wrap;

.storybook/preview.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import type { Preview } from "@storybook/react";
22

3+
import "@/styles/reset.scss";
4+
import "@/styles/global.scss";
35
import styles from "./preview.module.scss";
46

57
const preview: Preview = {

src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const App = () => {
88
<div className={styles.Test}>
99
<Button variant="primary" text="정보가 맞아요" />
1010
<Button variant="secondary" text="정보가 맞아요" />
11-
<Button variant="disabled" text="다시 스캔하기" />
11+
<Button variant="tertiary" text="다시 스캔하기" />
1212
<div className={styles.Test2}>
1313
<IconButton text="갤러리" iconName="gallery" />
1414
<IconButton text="카메라" iconName="camera" />

src/components/ui/BaseButton/BaseButton.module.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@
55
border-radius: 0.875rem;
66
width: 100%;
77
height: 3.25rem;
8+
padding: 0.875rem;
89
}

src/components/ui/Button/Button.module.scss

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,27 @@
11
@use "@/styles/mixins" as *;
22

33
.Button {
4+
@include buttonSecondary;
5+
46
&.style-primary {
57
background-color: var(--color-text01);
68
color: var(--color-white);
7-
@include buttonPrimary;
89
}
910

1011
&.style-secondary {
1112
background-color: var(--color-gray400);
1213
color: var(--color-white);
13-
@include buttonSecondary;
1414
}
1515

16-
&.style-disabled {
16+
&.style-tertiary {
17+
background-color: var(--color-gray200);
18+
color: var(--color-text02);
19+
}
20+
21+
&:disabled {
1722
background-color: var(--color-gray350);
1823
color: var(--color-text03);
19-
@include buttonSecondary;
24+
cursor: not-allowed;
2025
}
2126
}
2227

@@ -29,6 +34,7 @@
2934
display: flex;
3035
gap: 1rem;
3136
justify-content: center;
37+
align-items: center;
3238
width: 300px;
3339
}
3440

src/components/ui/Button/Button.stories.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ export const VariantProps: StoryObj<typeof Button> = {
3535
<Button variant="secondary" text="정보가 맞아요" />
3636
</div>
3737
<div className={styles.Wrapper}>
38-
<p className={styles.Text}>disabled</p>
39-
<Button variant="disabled" text="정보가 맞아요" />
38+
<p className={styles.Text}>tertiary</p>
39+
<Button variant="tertiary" text="정보가 맞아요" />
4040
</div>
4141
</div>
4242
),

src/components/ui/Button/Button.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import React, { useCallback } from "react";
1+
import { forwardRef, useCallback } from "react";
22

33
import classNames from "classnames";
44

55
import BaseButton from "@/components/ui/BaseButton/BaseButton";
66
import styles from "@/components/ui/Button/Button.module.scss";
77
import type { ButtonProps } from "@/components/ui/Button/Button.types";
88

9-
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
9+
const Button = forwardRef<HTMLButtonElement, ButtonProps>(
1010
(
1111
{ as = BaseButton, className, variant = "primary", text, disabled = false, onClick, ...props },
1212
ref,

src/components/ui/Button/Button.types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { ButtonOwnProps } from "@/components/ui/BaseButton/BaseButton.types";
22

3-
type ButtonVariant = "primary" | "secondary" | "disabled";
3+
type ButtonVariant = "primary" | "secondary" | "tertiary";
44

55
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, ButtonOwnProps {
66
variant?: ButtonVariant;

src/components/ui/IconButton/IconButton.module.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
&.size-sm {
1616
gap: 0.125rem;
1717
height: 2.375rem;
18+
padding: 0.5rem 0.875rem;
1819
background-color: var(--color-text01);
1920
color: var(--color-white);
2021
border-radius: 0.75rem;

0 commit comments

Comments
 (0)