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

[DESIGN] 디자인 시스템 세팅 #4

Merged
merged 8 commits into from
Apr 28, 2024
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
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"react-dom": "^18.2.0",
"react-router-dom": "^6.22.3",
"recoil": "^0.7.7",
"styled-components": "^6.1.8"
"styled-components": "^6.1.8",
"styled-reset": "^4.5.2"
},
"devDependencies": {
"@types/react": "^18.2.66",
Expand Down
Binary file added src/assets/fonts/SpoqaHanSansNeo-Bold.woff2
Binary file not shown.
Binary file added src/assets/fonts/SpoqaHanSansNeo-Light.woff2
Binary file not shown.
Binary file added src/assets/fonts/SpoqaHanSansNeo-Medium.woff2
Binary file not shown.
Binary file not shown.
Binary file added src/assets/fonts/SpoqaHanSansNeo-Thin.woff2
Binary file not shown.
4 changes: 1 addition & 3 deletions src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ import { RecoilRoot } from 'recoil';
import { ThemeProvider } from 'styled-components';

import { Router } from '@/router';
import { GlobalFont } from '@/styles/GlobalFont';
import { GlobalStyle } from '@/styles/GlobalStyle';
import { theme } from '@/styles/theme';
import { GlobalFont, GlobalStyle, theme } from '@/styles';

ReactDOM.createRoot(document.getElementById('root')!).render(
<RecoilRoot>
Expand Down
Empty file removed src/styles/.gitkeep
Empty file.
7 changes: 0 additions & 7 deletions src/styles/GlobalFont.ts

This file was deleted.

33 changes: 33 additions & 0 deletions src/styles/global/GlobalFont.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { createGlobalStyle } from 'styled-components';

export const GlobalFont = createGlobalStyle`
@font-face {
font-family: 'Spoqa Han Sans Neo';
font-style: normal;
src: url('../assets/fonts/SpoqaHanSansNeo-Bold.woff2') format('woff2'),
}

@font-face {
font-family: 'Spoqa Han Sans Neo';
font-style: normal;
src: url('../assets/fonts/SpoqaHanSansNeo-Medium.woff2') format('woff2'),
}

@font-face {
font-family: 'Spoqa Han Sans Neo';
font-style: normal;
src: url('../assets/fonts/SpoqaHanSansNeo-Regular.woff2') format('woff2'),
}

@font-face {
font-family: 'Spoqa Han Sans Neo';
font-style: normal;
src: url('../assets/fonts/SpoqaHanSansNeo-Light.woff2') format('woff2'),
}

@font-face {
font-family: 'Spoqa Han Sans Neo';
font-style: normal;
src: url('../assets/fonts/SpoqaHanSansNeo-Thin.woff2') format('woff2'),
}
`;
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { createGlobalStyle } from 'styled-components';
import reset from 'styled-reset';

export const GlobalStyle = createGlobalStyle`
${reset}
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
Expand Down
4 changes: 4 additions & 0 deletions src/styles/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export * from '@/styles/global/GlobalFont';
export * from '@/styles/global/GlobalStyle';

export * from '@/styles/theme/theme';
7 changes: 4 additions & 3 deletions src/styles/styled.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { ColorTypes, DeviceTypes, FontTypes } from '@/styles/theme/theme';
import 'styled-components';
import { ColorsTypes, FontsTypes } from './theme';

declare module 'styled-components' {
export interface DefaultTheme {
colors: ColorsTypes;
fonts: FontsTypes;
color: ColorTypes;
font: FontTypes;
device: DeviceTypes;
}
}
38 changes: 0 additions & 38 deletions src/styles/theme.ts

This file was deleted.

45 changes: 45 additions & 0 deletions src/styles/theme/color.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
export const color = {
black: '#000000',
white: '#ffffff',

// Primary
primary900: '#3d2669',
primary800: '#50328a',
primary700: '#6740b2',
primary600: '#8452e4',
primary500: '#915afb',
primary400: '#a77bfc',
primary300: '#b590fc',
primary200: '#ccb3fd',
primary100: '#ddccfe',
primary50: '#f4efff',

// Secondary
secondary900: '#66273b',
secondary800: '#86334e',
secondary700: '#ad4164',
secondary600: '#de5480',
secondary500: '#f45c8d',
secondary400: '#f67da4',
secondary300: '#f892b3',
secondary200: '#fab4cb',
secondary100: '#fcccdc',
secondary50: '#feeff4',

// Gray Scale
gray900: '#171717',
gray800: '#242424',
gray700: '#333333',
gray600: '#555555',
gray500: '#6f6f6f',
gray400: '#8b8b8b',
gray300: '#a5a5a5',
gray250: '#c1c1c1',
gray200: '#dfdfdf',
gray150: '#efefef',
gray100: '#f7f7f7',
gray50: '#fbfbfb',

// etc
bgModal: 'rgba(18, 18, 18, 0.36)',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기 18 -> 12로 수정해주세요

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

확인해봤는데 이건 틀린 게 없는 것 같아요..!

image

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

확인해봤는데 이건 틀린 게 없는 것 같아요..!

image

헉 그렇네요 수고하셨습니다!

} as const;
11 changes: 11 additions & 0 deletions src/styles/theme/device.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const deviceSizes = {
mobile: '320px',
tablet: '600px',
desktop: '1280px',
};

export const device = {
mobile: `screen and (min-width: ${deviceSizes.mobile}) and (max-width: ${deviceSizes.tablet})`,
tablet: `screen and (min-width: ${deviceSizes.tablet}) and (max-width: ${deviceSizes.desktop})`,
desktop: `screen and (min-width: ${deviceSizes.desktop})`,
};
178 changes: 178 additions & 0 deletions src/styles/theme/font.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
interface Font {
font: string;
weight: number;
size: number;
lineHeight: number;
}

const FONT = ({ font, weight, size, lineHeight }: Font): string => {
return `
font-family : "${font}";
font-weight: ${weight};
font-size : ${size}px;
line-height : ${lineHeight}px;
`;
};

export const font = {
desktop: {
d1: FONT({
font: 'Spoqa Han Sans Neo',
weight: 700,
size: 82,
lineHeight: 100,
}),
d2: FONT({
font: 'Spoqa Han Sans Neo',
weight: 500,
size: 65,
lineHeight: 80,
}),
h1: FONT({
font: 'Spoqa Han Sans Neo',
weight: 700,
size: 50,
lineHeight: 60,
}),
h2: FONT({
font: 'Spoqa Han Sans Neo',
weight: 400,
size: 40,
lineHeight: 50,
}),
title1: FONT({
font: 'Spoqa Han Sans Neo',
weight: 700,
size: 32,
lineHeight: 40,
}),
title2: FONT({
font: 'Spoqa Han Sans Neo',
weight: 500,
size: 25,
lineHeight: 32,
}),
body1m: FONT({
font: 'Spoqa Han Sans Neo',
weight: 500,
size: 18,
lineHeight: 28,
}),
body1r: FONT({
font: 'Spoqa Han Sans Neo',
weight: 400,
size: 18,
lineHeight: 28,
}),
body2m: FONT({
font: 'Spoqa Han Sans Neo',
weight: 500,
size: 16,
lineHeight: 24,
}),
body2r: FONT({
font: 'Spoqa Han Sans Neo',
weight: 400,
size: 16,
lineHeight: 24,
}),
label1m: FONT({
font: 'Spoqa Han Sans Neo',
weight: 500,
size: 14,
lineHeight: 20,
}),
label1r: FONT({
font: 'Spoqa Han Sans Neo',
weight: 400,
size: 14,
lineHeight: 20,
}),
label2: FONT({
font: 'Spoqa Han Sans Neo',
weight: 500,
size: 12,
lineHeight: 20,
}),
},
mobile: {
d1: FONT({
font: 'Spoqa Han Sans Neo',
weight: 500,
size: 58,
lineHeight: 64,
}),
d2: FONT({
font: 'Spoqa Han Sans Neo',
weight: 500,
size: 45,
lineHeight: 56,
}),
h1: FONT({
font: 'Spoqa Han Sans Neo',
weight: 500,
size: 36,
lineHeight: 44,
}),
h2: FONT({
font: 'Spoqa Han Sans Neo',
weight: 500,
size: 28,
lineHeight: 32,
}),
title1: FONT({
font: 'Spoqa Han Sans Neo',
weight: 700,
size: 22,
lineHeight: 28,
}),
title2: FONT({
font: 'Spoqa Han Sans Neo',
weight: 500,
size: 16,
lineHeight: 24,
}),
body1m: FONT({
font: 'Spoqa Han Sans Neo',
weight: 500,
size: 16,
lineHeight: 24,
}),
body1r: FONT({
font: 'Spoqa Han Sans Neo',
weight: 400,
size: 16,
lineHeight: 24,
}),
body2m: FONT({
font: 'Spoqa Han Sans Neo',
weight: 500,
size: 14,
lineHeight: 20,
}),
body2r: FONT({
font: 'Spoqa Han Sans Neo',
weight: 400,
size: 14,
lineHeight: 20,
}),
label1m: FONT({
font: 'Spoqa Han Sans Neo',
weight: 500,
size: 14,
lineHeight: 20,
}),
label1r: FONT({
font: 'Spoqa Han Sans Neo',
weight: 400,
size: 14,
lineHeight: 20,
}),
label2: FONT({
font: 'Spoqa Han Sans Neo',
weight: 500,
size: 12,
lineHeight: 20,
}),
},
};
14 changes: 14 additions & 0 deletions src/styles/theme/theme.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { DefaultTheme } from 'styled-components';

import { color } from '@/styles/theme/color';
import { device } from '@/styles/theme/device';
import { font } from '@/styles/theme/font';

export type ColorTypes = typeof color;
export type FontTypes = typeof font;
export type DeviceTypes = typeof device;
export const theme: DefaultTheme = {
color,
font,
device,
};
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2747,6 +2747,11 @@ styled-components@^6.1.8:
stylis "4.3.1"
tslib "2.5.0"

styled-reset@^4.5.2:
version "4.5.2"
resolved "https://registry.yarnpkg.com/styled-reset/-/styled-reset-4.5.2.tgz#2eba489fce52e34368693adb8d5fb4bf775edc3c"
integrity sha512-dbAaaVEhweBs2FGfqGBdW6oMcMK8238C2X5KCxBhUQJX92m/QyUfzRADOXhdXiXNkIPELtMCd72YY9eCdORfIw==

[email protected]:
version "4.3.1"
resolved "https://registry.yarnpkg.com/stylis/-/stylis-4.3.1.tgz#ed8a9ebf9f76fe1e12d462f5cc3c4c980b23a7eb"
Expand Down