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

[Feat] 디자인 시스템 초안 작성 #24

Merged
merged 26 commits into from
Jan 1, 2023
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
0867c90
[chore] 윈도우에서 cr prettier와 eslint 충돌 오류 해결
Kimsj912 Dec 3, 2022
d62b620
fix: fix window eslint error
Kimsj912 Dec 5, 2022
6e56aad
feat: Add GlobalStyle
Kimsj912 Dec 5, 2022
8a54370
feat: Add global theme
Kimsj912 Dec 5, 2022
5ac80e4
feat: Add theme
Kimsj912 Dec 5, 2022
cd77a79
feat: Add Example Component
Kimsj912 Dec 5, 2022
69f1851
feat: Remove GlobalStyle
Kimsj912 Dec 5, 2022
eb91bd5
fix: Image src missing 오류 해결
Kimsj912 Dec 6, 2022
349542c
refactor: eslint ban-ts-comment 제거
Kimsj912 Dec 6, 2022
c6022b7
refactor: change theme fontsize small name into sm
Kimsj912 Dec 6, 2022
b7595e0
refactor: Remove Example from _app.page.tsx
Kimsj912 Dec 7, 2022
5db0a66
props 제거
Kimsj912 Dec 25, 2022
e03dab3
Example Style Update
Kimsj912 Dec 25, 2022
8af1870
design system upgrade
Kimsj912 Dec 25, 2022
68113ed
common.css로 파일 분리
Kimsj912 Dec 31, 2022
315e093
theme 변경
Kimsj912 Jan 1, 2023
eb988a4
div 대신 <> 를 사용하도록 수정
Kimsj912 Jan 1, 2023
30fcdf1
inerface 명 ~~Props 방식으로 사용하도록 변경
Kimsj912 Jan 1, 2023
b0b9ff0
Merge branch 'develop' of https://github.com/YAPP-Github/21st-Web-Tea…
Kimsj912 Jan 1, 2023
485d6ff
package-lock.json 머지 오류 해결
Kimsj912 Jan 1, 2023
3b16da8
Example.tsx 괄호 정리
Kimsj912 Jan 1, 2023
b3cb6aa
border-radius 제거
Kimsj912 Jan 1, 2023
928bb4a
app_page.tsx 제거 및 style import 피드백 반영
Kimsj912 Jan 1, 2023
11bc8a1
절대 경로로 이동후 app.page.tsx로 이동
Kimsj912 Jan 1, 2023
b0cd9cc
Merge
Kimsj912 Jan 1, 2023
b501ae9
reset이 common보다 먼저오도록 수정
Kimsj912 Jan 1, 2023
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
9 changes: 8 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,14 @@ module.exports = {
],
plugins: ['@typescript-eslint', 'testing-library'],
ignorePatterns: ['dist/', 'node_modules/'],
rules: {},
rules: {
'prettier/prettier': [
'error',
{
endOfLine: 'auto',
},
],
},
overrides: [
{
files: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'],
Expand Down
16 changes: 16 additions & 0 deletions src/components/Example/Example.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { ComponentStory } from '@storybook/react';
import React from 'react';

import Example from '.';

export default {
component: Example,
title: 'Components/Example',
};

const Template: ComponentStory<typeof Example> = (args) => <Example {...args} />;

export const Default = Template.bind({});
Default.args = {
title: 'Example Word',
};
25 changes: 25 additions & 0 deletions src/components/Example/Example.style.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import styled from '@emotion/styled';

import theme from '../../styles/theme';
hwookim marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Collaborator

Choose a reason for hiding this comment

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

theme 를 제대로 적용했으면 props 로 theme 를 가져와야 하는데 지금은 theme 를 import 하는 구조인 거 같아요!
한번 확인해주세요!!

  • themeProvider 로 감싸서 처리하는거 같아요

https://emotion.sh/docs/theming

Copy link
Collaborator

Choose a reason for hiding this comment

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

아직까진 동적 테마를 사용하지 않기 때문에 상관은 없긴 할텐데,
만약 다크모드같은게 별도로 개발된다면 필요할지도 모르겠습니다.
다만 우리 사이트는 기본적으로 어두운 색 베이스고 디자이너도 고려하지 않기 때문에 필수적으로 적용할 필요는 없어보이긴 하네요 👀

stackoverflow에도 비슷한 논의가 하나 있네요.

말씀하신 방법은 props로 접근해야하기 때문에 조금 더 길어진다는 단점이 생기긴 합니다.
저는 import 방식도 충분히 괜찮다고 생각해요!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

저도 themeProvider가 나쁘진 않지만 import방식이 현재에는 좀 더 편리한것 같아요


const StyledButton = styled.button`
background-color: ${theme.color.bgSecondary};
color: ${theme.color.primaryLight};
border: 1px solid ${theme.color.borderPrimary};
border-radius: ${theme.borderRadius.sm};
padding: 8px 16px;
line-height: ${theme.lineHeight.lg};
font-size: ${theme.fontSize.md};
font-weight: ${theme.fontWeight.bold};
font-family: ${theme.fontFamily.mainTitle};
cursor: pointer;
transition: all 0.2s ease-in-out;
margin: 10px;

&:hover {
background-color: ${theme.color.bgThird};
color: ${theme.color.primaryDark};
}
`;

export default StyledButton;
18 changes: 18 additions & 0 deletions src/components/Example/Example.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import Image from 'next/image';
import React from 'react';

import StyledButton from './Example.style';

interface IMyButton {
hwookim marked this conversation as resolved.
Show resolved Hide resolved
title: string;
}

const MyButton = ({ title }: IMyButton) => {
return (
<div>
<StyledButton>{title}</StyledButton>
</div>
Copy link
Collaborator

Choose a reason for hiding this comment

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

어차피 예시긴 하지만,,
div로 감쌀 의미가 있을까요? 🤔

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ㅋㅋㅋㅋ 그러네요! <></>로 수정하겠습니다

Copy link
Collaborator

Choose a reason for hiding this comment

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

아예 아무것도 감싸지 않는 편이 좋을 것 같습니다!

);
};

export default MyButton;
1 change: 1 addition & 0 deletions src/components/Example/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './Example';
26 changes: 26 additions & 0 deletions src/styles/reset.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
@font-face {
font-family: 'Pretendard-Regular';
src: url('https://cdn.jsdelivr.net/gh/Project-Noonnu/[email protected]/Pretendard-Regular.woff') format('woff');
font-weight: 400;
font-style: normal;
}

hwookim marked this conversation as resolved.
Show resolved Hide resolved
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
Expand Down Expand Up @@ -89,6 +96,7 @@ video {
border: 0;
font-size: 100%;
font: inherit;
font-family: 'Pretendard-Regular', 'Noto Sans CJK KR', syne;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
Expand All @@ -107,6 +115,8 @@ section {
}
body {
line-height: 1;
background-color: #101012;
color: #f1f3f5;
}
ol,
ul {
Expand All @@ -127,3 +137,19 @@ table {
border-collapse: collapse;
border-spacing: 0;
}
h1 {
font-size: 20pt;
font-weight: bold;
}
h2 {
font-size: 18pt;
font-weight: medium;
}
h3 {
font-size: 16pt;
font-weight: regular;
}
p {
font-size: 14pt;
font-weight: regular;
}
65 changes: 65 additions & 0 deletions src/styles/theme.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
const theme = {
hwookim marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Collaborator

Choose a reason for hiding this comment

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

와우!! 너무 좋아졌네요!! 굿굿굿!! 👍👍

color: {
// common color
dark0: '#c1c2c5',
dark1: '#a6a7ab',
dark2: '#909296',
dark3: '#5c5f66',
dark4: '#373a40',
dark5: '#2c2e33',
dark6: '#25262b',
dark7: '#1a1b1e',
dark8: '#141517',
dark9: '#101113',
primaryLight: '#d2fa64',
primaryDark: '#b2dd3c',
secondaryLight: '#ff3d60',
secondaryDark: '#e02d4d',
// specialized color
bgPrimary: '#101012',
bgSecondary: '#212529',
bgThird: '#2c2e33',
topicPrimary: '#ff7991',
topicSecondary: '#aef19d',
txtPrimary: '#f1f3f5',
txtSecondary: '#6E7178',
txtDanger: '#ff0000',
borderPrimary: '#f8f9fa',
},
fontFamily: {
basic: 'Pretendard',
mainTitle: 'Syne',
},
fontWeight: {
light: 300,
regular: 400,
bold: 700,
},
fontSize: {
xxsm: '8px',
xsm: '12px',
sm: '14px',
md: '15px',
lg: '16px',
xlg: '18px',
xxlg: '20px',
xxxlg: '24px',
},
lineHeight: {
md: '130%',
lg: '150%',
},
// TODO: 반응형 도입시 재정의 필요. (임시로 기준값 설정한 상태)
responsive: {
sm: '480px',
md: '768px',
lg: '1024px',
},
borderRadius: {
sm: '10px', // card item
md: '20px', // card
lg: '16px', // hashtag
Copy link
Collaborator

Choose a reason for hiding this comment

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

md보다 lg가 더 작네요?? 👀

Select button의 경우에는 8px이기도 하고, Toggle button100px이고...
이 경우에는 관리하기 보다는 각각 파일에서 지정해주는 게 더 효율적일 것 같다는 생각이 듭니다!

Copy link
Collaborator

Choose a reason for hiding this comment

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

스토리북에 Color 하고 fontSize 별 typography 스토리북도 있으면 좋을거 같아요! (너무 바쁘시면 추후에 도입해도 괜찮을거 같긴합니다, 제가 해도 괜찮구요!)

[참고]

},
} as const;

export default theme;