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

[Feat/#9] font, color Theme 설정 #10

Merged
merged 3 commits into from
Jan 25, 2025
Merged

[Feat/#9] font, color Theme 설정 #10

merged 3 commits into from
Jan 25, 2025

Conversation

ljh0608
Copy link
Contributor

@ljh0608 ljh0608 commented Jan 20, 2025

이슈 번호

#9

작업한 내용

  • theme관련 타입 및 Provier 초기 세팅
  • color 및 font theme 세팅

작업 결과

image

비고

찾아보니 styled-theming이라는걸 사용해서 다크모드/라이트모드를 조금 더 쉽게 관리할 수 있더라고! 사용하지 않아도 구현 가능해서 이부분은 추후 필요하면 조금 더 알아보고 적용해도 좋을 듯해서 일단 링크 남겨둘게~
https://styled-components.com/docs/tooling#styled-theming

@ljh0608 ljh0608 requested a review from Jxxunnn January 20, 2025 18:27
@ljh0608 ljh0608 self-assigned this Jan 20, 2025
Copy link

vercel bot commented Jan 20, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
ddd-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 23, 2025 6:56am

Copy link
Member

@Jxxunnn Jxxunnn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생했어~ 댓글 몇 개 남겨놨는데 확인 부탁해 👍

src/app/layout.tsx Outdated Show resolved Hide resolved
src/shared/lib/styledComponents/theme.ts Outdated Show resolved Hide resolved
Comment on lines +1 to +8
import "styled-components";
import { ColorsTypes, FontsTypes } from "./theme";
declare module "styled-components" {
export interface DefaultTheme {
colors: ColorsTypes;
fonts: FontsTypes;
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3. 이렇게 작성해도 기능에 문제 없을 것 같은데 어때?

Suggested change
import "styled-components";
import { ColorsTypes, FontsTypes } from "./theme";
declare module "styled-components" {
export interface DefaultTheme {
colors: ColorsTypes;
fonts: FontsTypes;
}
}
import { ColorsTypes, FontsTypes } from "./theme";
declare module "styled-components" {
interface DefaultTheme {
colors: ColorsTypes;
fonts: FontsTypes;
}
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://styled-components.com/docs/api#typescript

이부분은 공식문서에 예시를 참고한건데 준근이 말대로 없어도 동작이 동작에는 문제가 없는데 공식문서에서
import "styled-components" 부분은 original module 선언을 import하고 그 아래에서 확장한다고 나와있어서 적용한거거든
내가 적용한 방식이 값을 먼저 지정하고 거기서 타입을 빼오는 방식이라 필요없는건가??

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

흐음 나도 이유를 잘 모르겠네.. 문서가 오래된 버전인 걸지도? 우리가 설치한 버전 기준으로 DefaultTheme의 JSDoc 주석에는 이렇게 작성되어 있어.

/**
 * Override DefaultTheme to get accurate typings for your project.
 *
 * ```
 * // create styled-components.d.ts in your project source
 * // if it isn't being picked up, check tsconfig compilerOptions.types
 * import type { CSSProp } from "styled-components";
 * import Theme from './theme';
 *
 * type ThemeType = typeof Theme;
 *
 * declare module "styled-components" {
 *  export interface DefaultTheme extends ThemeType {}
 * }
 *
 * declare module "react" {
 *  interface DOMAttributes<T> {
 *    css?: CSSProp;
 *  }
 * }
 * ```
 */

@Jxxunnn Jxxunnn changed the title feat: font, color Theme 설정 [Feat/#9] font, color Theme 설정 Jan 21, 2025
@Jxxunnn Jxxunnn linked an issue Jan 22, 2025 that may be closed by this pull request
Copy link
Member

@Jxxunnn Jxxunnn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

리뷰 남긴 부분은 다 해소된 것 같아서 Approve 눌러놓을게 고생 많았어! 👍

@ljh0608 ljh0608 merged commit 025b23b into main Jan 25, 2025
2 checks passed
@ljh0608 ljh0608 deleted the feat/#9 branch January 25, 2025 06:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[기능] Font theme 세팅
2 participants