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

[ 🌈 Notice] μ „μ—­ μŠ€νƒ€μΌ μ‚¬μš©λ²• #4

Closed
Happhee opened this issue Jan 2, 2023 · 0 comments
Closed
Assignees

Comments

@Happhee
Copy link
Contributor

Happhee commented Jan 2, 2023

🌈 μ–΄λ–€ κΈ°λŠ₯μΈκ°€μš”?

μŠ€νƒ€μΌ μ‚¬μš© λ°©λ²•μž…λ‹ˆλ‹€!!

✨ style.d.ts

import 'styled-components';

declare module 'styled-components' {
  export interface DefaultTheme {
    colors: {
      Pic_Color_Coral: string;
      Pic_Color_Yellow: string;
      Pic_Color_Blue: string;
      Pic_Color_Sky: string;
      Pic_Color_Gray_Black: string;
      Pic_Color_Gray_2: string;
      Pic_Color_Gray_3: string;
      Pic_Color_Gray_4: string;
      Pic_Color_Gray_5: string;
      Pic_Color_Gray_6: string;
      Pic_Color_White: string;
    };
    fonts: {
      Pic_Title1_Pretendard_Bold_24: SerializedStyles;
      Pic_Title2_Pretendard_Bold_20: SerializedStyles;
      Pic_Subtitle1_Pretendard_Semibold_20: SerializedStyles;
      Pic_Body1_Pretendard_Medium_16: SerializedStyles;
      Pic_Caption1_Pretendard_Semibold_12: SerializedStyles;
    };
  }
}

✨ theme.ts

import { css, DefaultTheme } from 'styled-components';

const colors = {
  Pic_Color_Coral: '#FF5D5D',
  Pic_Color_Yellow: '#FFFDC2',
  Pic_Color_Blue: '#3973CB',
  Pic_Color_Sky: '#C6DDFF',
  Pic_Color_Gray_Black: '#1E1F21',
  Pic_Color_Gray_2: '#525C67',
  Pic_Color_Gray_3: '#8A949E',
  Pic_Color_Gray_4: '#C3CDD5',
  Pic_Color_Gray_5: '#E8EBEF',
  Pic_Color_Gray_6: '#F4F5F7',
  Pic_Color_White: '#FFFFFF',
};

const fonts = {
  Pic_Title1_Pretendard_Bold_24: css`
    font-family: 'PretendardBold';
    font-size: 2.4rem;
    font-weight: 700;
    font-style: normal;
    line-height: 2.9rem;
  `,
  Pic_Title2_Pretendard_Bold_20: css`
    font-family: 'PretendardBold';
    font-size: 2rem;
    font-weight: 700;
    font-style: normal;
    line-height: 2.4rem;
  `,
  Pic_Subtitle1_Pretendard_Semibold_20: css`
    font-family: 'PretendardSemiBold';
    font-size: 2rem;
    font-weight: 600;
    font-style: normal;
    line-height: 2.4rem;
  `,
  Pic_Body1_Pretendard_Medium_16: css`
    font-family: 'PretendardMedium';
    font-size: 1.6rem;
    font-weight: 500;
    font-style: normal;
    line-height: 1.9rem;
  `,
  Pic_Caption1_Pretendard_Semibold_12: css`
    font-family: 'PretendardSemiBold';
    font-size: 1.2rem;
    font-weight: 600;
    font-style: normal;
    line-height: 1.4rem;
  `,
};

const theme: DefaultTheme = {
  colors,
  fonts,
};
export default theme;

font πŸ‘‰ 같은 κ²½μš°μ—λŠ” ν”Όκ·Έλ§ˆμ— μ§€μ •λœ font, colorλͺ…μœΌλ‘œ μ—°κ²°μ‹œμΌœμ„œ ν”Όκ·Έλ§ˆμ— μ—…λ‘œλ“œ ν•΄μ£Όμ‹ λ‹€κ³  ν•©λ‹ˆλ‹€!

✨ μ‚¬μš©λ²•

const StGuide = styled.div`
  // 색상 μ„€μ •
  background-color: ${({ theme }) => theme.colors.Pic_Color_Blue};

  // 폰트 μ„€μ • , μ• μ΄ˆμ— font-family, size, weight λ‹€ 지정해 μ£Όμ—ˆκΈ° λ•Œλ¬Έμ— ν•œμ€„λ‘œ μ„ μ–Έν•˜λŠ” 것이 κ°€λŠ₯ν•©λ‹ˆλ‹€!
 //  πŸ‘‰   ${({ theme }) => theme.fonts.Pic_Title2_Pretendard_Bold_20}
`

ν•œ 번 μ μš©ν•΄λ³΄κ³  ν•΄μ£Όμ„Έμš”πŸ’›

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant