-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #82 from sopt-makers/feat/storybook
[DOCS] Fonts storybook
- Loading branch information
Showing
3 changed files
with
104 additions
and
20 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -2,46 +2,41 @@ | |
box-sizing: border-box; | ||
padding: 0; | ||
margin: 0; | ||
font-family: 'SUIT', sans-serif; | ||
font-family: "SUIT", sans-serif; | ||
font-style: normal; | ||
} | ||
|
||
body { | ||
background-color: rgb(0,0,0) | ||
background-color: rgb(0, 0, 0); | ||
} | ||
|
||
@font-face { | ||
font-family: 'SUIT'; | ||
src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/[email protected]/SUIT-Light.woff2') | ||
format('woff2'); | ||
font-family: "SUIT"; | ||
src: url("https://cdn.jsdelivr.net/gh/projectnoonnu/[email protected]/SUIT-Light.woff2") format("woff2"); | ||
font-weight: 300; | ||
font-style: normal; | ||
} | ||
@font-face { | ||
font-family: 'SUIT'; | ||
src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/[email protected]/SUIT-Regular.woff2') | ||
format('woff2'); | ||
font-family: "SUIT"; | ||
src: url("https://cdn.jsdelivr.net/gh/projectnoonnu/[email protected]/SUIT-Regular.woff2") format("woff2"); | ||
font-weight: 400; | ||
font-style: normal; | ||
} | ||
@font-face { | ||
font-family: 'SUIT'; | ||
src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/[email protected]/SUIT-Medium.woff2') | ||
format('woff2'); | ||
font-family: "SUIT"; | ||
src: url("https://cdn.jsdelivr.net/gh/projectnoonnu/[email protected]/SUIT-Medium.woff2") format("woff2"); | ||
font-weight: 500; | ||
font-style: normal; | ||
} | ||
@font-face { | ||
font-family: 'SUIT'; | ||
src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/[email protected]/SUIT-SemiBold.woff2') | ||
format('woff2'); | ||
font-family: "SUIT"; | ||
src: url("https://cdn.jsdelivr.net/gh/projectnoonnu/[email protected]/SUIT-SemiBold.woff2") format("woff2"); | ||
font-weight: 600; | ||
font-style: normal; | ||
} | ||
@font-face { | ||
font-family: 'SUIT'; | ||
src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/[email protected]/SUIT-Bold.woff2') | ||
format('woff2'); | ||
font-family: "SUIT"; | ||
src: url("https://cdn.jsdelivr.net/gh/projectnoonnu/[email protected]/SUIT-Bold.woff2") format("woff2"); | ||
font-weight: 700; | ||
font-style: normal; | ||
} | ||
|
@@ -58,7 +53,7 @@ body { | |
flex-direction: column; | ||
gap: 16px; | ||
color: white; | ||
font-family: 'SUIT', sans-serif; | ||
font-family: "SUIT", sans-serif; | ||
|
||
h4 { | ||
font-size: 28px; | ||
|
@@ -101,4 +96,36 @@ body { | |
height: 80px; | ||
} | ||
} | ||
} | ||
} | ||
|
||
.fonts-wrap { | ||
padding: 20px; | ||
color: white; | ||
display: flex; | ||
flex-direction: column; | ||
gap: 20px; | ||
width: 1000px; | ||
} | ||
|
||
.fonts-group { | ||
border: 1px solid #3f3f47; | ||
padding: 15px 20px; | ||
border-radius: 10px; | ||
|
||
& > p:first-of-type { | ||
font-size: 20px; | ||
font-weight: 700; | ||
margin-bottom: 16px; | ||
} | ||
& > div { | ||
margin-bottom: 16px; | ||
|
||
p { | ||
color: #c3c3c6; | ||
font-size: 16px; | ||
} | ||
span { | ||
color: #808087; | ||
} | ||
} | ||
} |
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,57 @@ | ||
import { fontsObject } from '@sopt-makers/fonts'; | ||
import { ChangeEvent, useState } from 'react'; | ||
import { TextField } from '@sopt-makers/ui'; | ||
|
||
export default { | ||
title: 'fonts/Fonts' | ||
} | ||
|
||
type FontName = keyof typeof fontsObject; | ||
|
||
const useInput = (defaultValue: string) => { | ||
const [input, setInput] = useState(defaultValue); | ||
|
||
const handleInputChange = (e: ChangeEvent<HTMLInputElement>) => { | ||
setInput(e.target.value); | ||
} | ||
|
||
return [input, handleInputChange] as const; | ||
} | ||
|
||
export const Default = () => { | ||
const [text, handleTextChange] = useInput('SOPT에 없던 새로운 가치를 프로덕트를 통해 만들어 갑니다.'); | ||
|
||
const getFontColor = (fontType: string) => { | ||
switch (fontType) { | ||
case 'HEADING': | ||
return '#FFC234'; | ||
case 'TITLE': | ||
return '#16BF81'; | ||
case 'BODY': | ||
return '#F77234'; | ||
case 'LABEL': | ||
return '#346FFA'; | ||
} | ||
} | ||
|
||
return <div className="fonts-wrap"> | ||
<p style={{ fontSize: '20px' }}>* 공통 스타일 - fontFamily : SUIT / fontStyle : normal *</p> | ||
<TextField<string> value={text} onChange={handleTextChange} placeholder="예시 문장을 입력해주세요" /> | ||
|
||
{Object.keys(fontsObject).map((fontName) => { | ||
const fontObject = fontsObject[fontName as FontName]; | ||
|
||
return <div key={fontName} className="fonts-group"> | ||
<p style={{ color: getFontColor(fontName.split('_')[0]) }}>{fontName}</p> | ||
<div> | ||
<p><span>fontWeight : </span>{fontObject.fontWeight}</p> | ||
<p><span>fontSize : </span>{fontObject.fontSize}</p> | ||
<p><span>lineHeight : </span>{fontObject.lineHeight}</p> | ||
<p><span>letterSpacing : </span>{fontObject.letterSpacing}</p> | ||
</div> | ||
<p style={fontObject}>{text}</p> | ||
</div> | ||
} | ||
)} | ||
</div> | ||
} |