-
Notifications
You must be signed in to change notification settings - Fork 10
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
[Chore] Emotion theme 세팅 #252
Merged
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
const path = require('path'); | ||
|
||
import type { Preview } from '@storybook/react'; | ||
import React from 'react'; | ||
import GlobalStyle from '../src/styles/globalStyle'; | ||
import { ThemeProvider } from '@emotion/react'; | ||
import { theme } from '../src/styles/theme'; | ||
|
||
const preview: Preview = { | ||
decorators: [ | ||
Story => ( | ||
<ThemeProvider theme={theme}> | ||
<GlobalStyle /> | ||
<Story /> | ||
</ThemeProvider> | ||
), | ||
], | ||
parameters: { | ||
actions: { argTypesRegex: '^on[A-Z].*' }, | ||
controls: { | ||
matchers: { | ||
color: /(background|color)$/i, | ||
date: /Date$/, | ||
}, | ||
}, | ||
webpackFinal: async config => { | ||
config.resolve.alias = { | ||
...config.resolve.alias, | ||
'~': path.resolve(__dirname, '../src/'), | ||
}; | ||
return config; | ||
}, | ||
}, | ||
}; | ||
|
||
export default preview; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import '@emotion/react'; | ||
|
||
import { theme } from '~/styles/theme'; | ||
|
||
declare module '@emotion/react' { | ||
type CustomTheme = typeof theme; | ||
|
||
export interface Theme extends CustomTheme {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,29 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
import { Meta } from '@storybook/react'; | ||
|
||
import { FAQ } from './index'; | ||
|
||
const meta: Meta<typeof FAQ> = { | ||
title: 'components/FAQ', | ||
component: FAQ, | ||
args: {}, | ||
}; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof FAQ>; | ||
export const Close = { | ||
render: () => ( | ||
<FAQ | ||
isOpen={false} | ||
title="직장인도 참여 가능한가요?" | ||
description="디프만 모집은 직업, 연령 등 자격 요건에 제한을 두지 않습니다. 그러나 팀원들과 작업 속도, 일정을 맞추려면 더 많은 개인 시간을 할애할 필요가 있습니다. 따라서 회사 업무와 프로젝트를 병행할 수 있을지 충분히 고려하여 지원부탁드립니다." | ||
/> | ||
), | ||
}; | ||
|
||
export const Primary: Story = { | ||
render: () => <FAQ />, | ||
export const Open = { | ||
render: () => ( | ||
<FAQ | ||
isOpen={true} | ||
title="직장인도 참여 가능한가요?" | ||
description="디프만 모집은 직업, 연령 등 자격 요건에 제한을 두지 않습니다. 그러나 팀원들과 작업 속도, 일정을 맞추려면 더 많은 개인 시간을 할애할 필요가 있습니다. 따라서 회사 업무와 프로젝트를 병행할 수 있을지 충분히 고려하여 지원부탁드립니다." | ||
/> | ||
), | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,29 @@ | ||
export function FAQ() { | ||
return <div>FAQ</div>; | ||
import { css, Theme } from '@emotion/react'; | ||
|
||
import { ArrowIcon } from '~/components/Icons'; | ||
|
||
interface FAQProps { | ||
isOpen: boolean; | ||
title: string; | ||
description: string; | ||
} | ||
|
||
export function FAQ({ isOpen, title, description }: FAQProps) { | ||
return ( | ||
<div> | ||
<div> | ||
<h3 css={titleCss}>{title}</h3> | ||
<ArrowIcon direction={isOpen ? 'up' : 'down'} /> | ||
</div> | ||
<div> | ||
<p>{description}</p> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
const titleCss = (theme: Theme) => css` | ||
color: ${theme.colors.black800}; | ||
text-align: center; | ||
${theme.typos.pretendard.subTitle2} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { colors } from './colors'; | ||
import { typos } from './typo'; | ||
|
||
export const theme = { | ||
colors, | ||
typos, | ||
} as const; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { css } from '@emotion/react'; | ||
|
||
export const typos = { | ||
pretendard: { | ||
subTitle1: css` | ||
/* Pretendard/Subtitle Bold */ | ||
font-size: 32px; | ||
font-style: normal; | ||
font-weight: 700; | ||
line-height: 150%; /* 48px */ | ||
letter-spacing: -0.32px; | ||
`, | ||
subTitle2: css` | ||
/* Pretendard/Subtitle 2 Bold */ | ||
font-size: 20px; | ||
font-style: normal; | ||
font-weight: 500; | ||
line-height: 150%; /* 30px */ | ||
letter-spacing: -0.2px; | ||
`, | ||
body1: css` | ||
/* Pretendard/Body 1 Medium */ | ||
font-size: 18px; | ||
font-style: normal; | ||
font-weight: 500; | ||
line-height: 25.2px; /* 140% */ | ||
letter-spacing: -0.18px; | ||
`, | ||
}, | ||
decimal: { | ||
title1: css` | ||
/* Decimal/Title 1 */ | ||
font-size: 60px; | ||
font-style: normal; | ||
font-weight: 600; | ||
line-height: 135%; /* 81px */ | ||
text-transform: capitalize; | ||
`, | ||
title2: css` | ||
/* Decimal/Title 2 */ | ||
font-size: 40px; | ||
font-style: normal; | ||
font-weight: 600; | ||
line-height: 135%; /* 54px */ | ||
text-transform: capitalize; | ||
`, | ||
subTitle1: css` | ||
/* Decimal/Subtitle 1 */ | ||
font-size: 28px; | ||
font-style: normal; | ||
font-weight: 600; | ||
line-height: 30px; /* 107.143% */ | ||
letter-spacing: -0.28px; | ||
`, | ||
body1: css` | ||
/* Decimal/Body 1 */ | ||
font-size: 18px; | ||
font-style: normal; | ||
font-weight: 500; | ||
line-height: 25.2px; /* 140% */ | ||
letter-spacing: -0.18px; | ||
`, | ||
}, | ||
}; |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rem으로 바꾸는건 어떨까욥?!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
좋아요~