Skip to content

Commit

Permalink
feat: Text 굵기 선택 지원 + global.ts weight 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
whitedev7773 committed Aug 28, 2024
1 parent edbfe53 commit 3c82f7b
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/components/typography/Text.style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,25 @@ export const TextElement = styled.span<TextProps>`
}
}};
font-weight: ${(props) => {
switch (props.weight) {
case "l":
return "var(--font-weight-l)";
case "r":
return "var(--font-weight-r)";
case "b":
return "var(--font-weight-b)";
case "eb":
return "var(--font-weight-eb)";
case "h":
return "var(--font-weight-h)";
case undefined:
return "var(--font-weight-r)";
default:
return props.weight;
}
}};
color: ${(props) => {
switch (props.color) {
case "primary":
Expand Down
1 change: 1 addition & 0 deletions src/components/typography/Text.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { TextElement } from "./Text.style";

export interface TextProps extends React.ComponentProps<"span"> {
size: "xs" | "s" | "m" | "l" | "xl";
weight?: "l" | "r" | "b" | "eb" | "h";
children: React.ReactNode;
}

Expand Down
5 changes: 5 additions & 0 deletions src/styles/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ export const GlobalStyle = css`
--font-size-m: 18px;
--font-size-s: 16px;
--font-size-xs: 13px;
--font-weight-l: 300;
--font-weight-r: 400;
--font-weight-b: 700;
--font-weight-eb: 800;
--font-weight-h: 900;
--color-primary: #37cdcd;
--color-primary-300: #64e4e0;
Expand Down

0 comments on commit 3c82f7b

Please sign in to comment.