Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

디자인시스템-타이포그래피-적용 #5

Merged
merged 4 commits into from
Nov 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions client/.dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
Dockerfile
.dockerignore
storybook.Dockerfile
storybook-static
node_modules
npm-debug.log
README.md
Expand Down
6 changes: 3 additions & 3 deletions client/src/app/auth/login/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,19 @@ const LoginPage = () => {
<Avatar sx={{ m: 1, bgcolor: "secondary.main" }}>
<LockOutlinedIcon />
</Avatar>
<Typography component="h1" variant="h5">
<Typography component="h1" variant="h1">
Sign in
</Typography>
{/* form */}
<SigninForm />
<Grid container>
<Grid item xs>
<Link href={FORGOTPASSWORD}>
<Typography variant="body2">Forgot password?</Typography>
<Typography variant="label">Forgot password?</Typography>
</Link>
</Grid>
<Grid item>
<Typography variant="body2">
<Typography variant="label">
계정이 없으신가요? <Link href={SIGNUP}>회원가입</Link>
</Typography>
</Grid>
jobkaeHenry marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
67 changes: 67 additions & 0 deletions client/src/const/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,50 @@ import Pretendard from "~/assets/font/Pretendard";
const theme = createTheme({
typography: {
fontFamily: Pretendard.style.fontFamily,
allVariants: { letterSpacing: "-0.01em", fontWeight: 400 },
h1: {
fontSize: "24px",
lineHeight: "40px",
letterSpacing: "0em",
},
h2: {
fontSize: "22px",
lineHeight: "32px",
},
subtitle1: {
fontSize: "20px",
lineHeight: "32px",
},
subtitle2: {
fontSize: "18px",
lineHeight: "24px",
},
body1: {
fontSize: "16px",
lineHeight: "18px",
},
button: {
fontSize: "16px",
lineHeight: "16px",
},
label: {
fontSize: "14px",
lineHeight: "16px",
letterSpacing: "0em",
},
caption: {
fontSize: "12px",
lineHeight: "16px",
},

fontWeightRegular: 400,
fontWeightBold: 700,

h4: undefined,
h3: undefined,
h5: undefined,
h6: undefined,
body2: undefined,
},
palette: {
mode: "light",
Expand Down Expand Up @@ -35,4 +79,27 @@ const theme = createTheme({
},
});

declare module "@mui/material/styles" {
interface TypographyVariants {
label: React.CSSProperties;
}

// allow configuration using `createTheme`
interface TypographyVariantsOptions {
label?: React.CSSProperties;
}
}

// Update the Typography's variant prop options
declare module "@mui/material/Typography" {
interface TypographyPropsVariantOverrides {
label: true;
h3: false;
h4: false;
h5: false;
h6: false;
body2: false;
}
}

export default theme;
jobkaeHenry marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Button, ButtonProps as MuiButtonProps } from "@mui/material";
import { Meta, StoryObj } from "@storybook/react";

const meta = {
title: "Design system/Button",
title: "Design system/Input/Button",
component: Button,
tags: ["autodocs"],
argTypes: {
Expand Down
89 changes: 89 additions & 0 deletions client/src/stories/Design_system/Typography.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
import { Typography } from "@mui/material";
import { Meta, StoryObj } from "@storybook/react";
const meta = {
title: "Design system/Typography",
component: Typography,
tags: ["autodocs"],
argTypes: {
variant: {
options: [
"h1",
"h2",
"subtitle1",
"subtitle2",
"body",
"button",
"label",
"caption",
],
default: "body",
control: { type: "select" },
},
},
decorators: [
(Story, ctx) => {
return (
<div style={{ display: "flex", flexDirection: "column" }}>
<Typography variant={ctx.args.variant} sx={{ fontWeight: "bold" }}>
{ctx.args.children}
</Typography>
<Story />
</div>
);
},
],
} satisfies Meta<typeof Typography>;

export default meta;
type Story = StoryObj<typeof meta>;

export const Heading1: Story = {
args: {
variant: "h1",
children: "오늘은 이거다 주酒, D-SHOT, DA(alcohol)ily",
},
};

export const Heading2: Story = {
args: {
...Heading1.args,
variant: "h2",
},
};

export const Subtitle1: Story = {
args: {
...Heading1.args,
variant: "subtitle1",
},
};
export const Subtitle2: Story = {
args: {
...Heading1.args,
variant: "subtitle1",
},
};
export const Body1: Story = {
args: {
...Heading1.args,
variant: "body1",
},
};
export const Button: Story = {
args: {
...Heading1.args,
variant: "button",
},
};
export const Label: Story = {
args: {
...Heading1.args,
variant: "label",
},
};
export const Caption: Story = {
args: {
...Heading1.args,
variant: "caption",
},
};
jobkaeHenry marked this conversation as resolved.
Show resolved Hide resolved