-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
module css 적용 및 layout 파일 서버 컴포넌트로 변경 (#187)
* feat: module css 적용 * feat: module css에 global css, getClassNames 함수 구현
- Loading branch information
Showing
14 changed files
with
1,166 additions
and
36 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
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 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
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 { getClassNames } from "lib/styles/getClassNames"; | ||
import { PropsWithChildren } from "react"; | ||
import styles from "./styles.module.css"; | ||
|
||
const cx = getClassNames(styles); | ||
|
||
export const PageLayout = ({ children }: PropsWithChildren) => { | ||
return <div className={cx("rootlayout")}>{children}</div>; | ||
}; |
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 @@ | ||
export * from "./PageLayout"; |
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,4 @@ | ||
.rootlayout { | ||
max-width: 720px; | ||
margin: 0 auto; | ||
} |
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,32 @@ | ||
import typography from "./typography.module.css"; | ||
|
||
type Styles = { [key: string]: string }; | ||
export function getClassNames<T extends Styles>(styles: T) { | ||
type BooleanMap = Partial<Record<keyof T, boolean> & { [key: string]: boolean }>; | ||
type ClassNames = keyof T | false | null | undefined | BooleanMap; | ||
type ExtraClassName = ClassNames | Omit<string, keyof T>; | ||
|
||
const styleUtils = { | ||
...typography, | ||
...styles, | ||
} as const; | ||
|
||
type MergedClassName = ExtraClassName | keyof typeof styleUtils; | ||
|
||
const fn = (...classNames: MergedClassName[]) => { | ||
return (classNames.filter((cn) => cn) as (keyof T)[]) | ||
.map((className) => { | ||
if (typeof className === "object") { | ||
const keys = Object.keys(className) as (keyof T)[]; | ||
return keys | ||
.filter((key) => className[key]) | ||
.map((key) => styleUtils[key]) | ||
.join(" "); | ||
} | ||
return styleUtils[className] ?? className; | ||
}) | ||
.join(" "); | ||
}; | ||
|
||
return fn; | ||
} |
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,27 @@ | ||
:root { | ||
--black_01: "#222222", | ||
--black_02: "#373737", | ||
--black_03: "#676767", | ||
--black_04: "#898989", | ||
--black_05: "#cccccc", | ||
--white: "#ffffff", | ||
--bg_01: "#f0f0f0", | ||
--bg_02: "#f5f5f5", | ||
--line_01: "#e9e9e9", | ||
--line_02: "#f5f5f5", | ||
--main_01: "#ff4a16", | ||
--main_02: "#ffe8e1", | ||
--sub_01: "#ffa183", | ||
--sub_02: "#aedac4", | ||
--system_red: "#dc0000", | ||
--system_green: "#04b014", | ||
--system_yellow: "#f5a623", | ||
--system_blue: "rgba(0, 26, 255, 0.80)", | ||
--system_black: "rgba(0, 0, 0, 0.80)", | ||
--modal: "rgba(0, 0, 0, 0.5)", | ||
--main_drop_shadow_top: "rgba(235, 235, 235, 0.80)", | ||
--main_drop_shadow_bottom: "rgba(235, 235, 235, 0.80)", | ||
--modal_shadow: "rgba(235, 235, 235, 0.80)", | ||
--kakao: "#fee500", | ||
--naver: "#03c75a", | ||
} |
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,103 @@ | ||
.headline01 { | ||
font-size: 24px; | ||
font-weight: 700; | ||
line-height: 32px; | ||
letter-spacing: -0.24px; | ||
} | ||
|
||
.headline02 { | ||
font-size: 20px; | ||
font-weight: 700; | ||
line-height: 28px; | ||
letter-spacing: -0.2px; | ||
} | ||
|
||
.headline03 { | ||
font-size: 18px; | ||
font-weight: 600; | ||
line-height: 24px; | ||
letter-spacing: -0.18px; | ||
} | ||
|
||
.headline04 { | ||
font-size: 16px; | ||
font-weight: 700; | ||
line-height: 22px; | ||
letter-spacing: -0.16px; | ||
} | ||
|
||
.subhead01 { | ||
font-size: 18px; | ||
font-weight: 400; | ||
line-height: 24px; | ||
letter-spacing: -0.18px; | ||
} | ||
|
||
.subhead02 { | ||
font-size: 14px; | ||
font-weight: 400; | ||
line-height: 18px; | ||
letter-spacing: -0.14px; | ||
} | ||
|
||
.body01 { | ||
font-size: 16px; | ||
font-weight: 700; | ||
line-height: 22px; | ||
letter-spacing: -0.16px; | ||
} | ||
|
||
.body_long01 { | ||
font-size: 16px; | ||
font-weight: 700; | ||
line-height: 24px; | ||
letter-spacing: -0.16px; | ||
} | ||
|
||
.body02 { | ||
font-size: 16px; | ||
font-weight: 400; | ||
line-height: 24px; | ||
} | ||
|
||
.body03 { | ||
font-size: 14px; | ||
font-weight: 400; | ||
line-height: 18px; | ||
} | ||
|
||
.body_long03 { | ||
font-size: 14px; | ||
font-weight: 400; | ||
line-height: 20px; | ||
} | ||
|
||
.body04 { | ||
font-size: 14px; | ||
font-weight: 700; | ||
line-height: 18px; | ||
} | ||
|
||
.caption_chip { | ||
font-size: 12px; | ||
font-weight: 600; | ||
line-height: 14px; | ||
} | ||
|
||
.navigation { | ||
font-size: 10px; | ||
font-weight: 500; | ||
line-height: 14px; | ||
} | ||
|
||
.button01 { | ||
font-size: 14px; | ||
font-weight: 600; | ||
line-height: 18px; | ||
} | ||
|
||
.button02 { | ||
font-size: 14px; | ||
font-weight: 400; | ||
line-height: 18px; | ||
} |
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
Oops, something went wrong.