-
Notifications
You must be signed in to change notification settings - Fork 0
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
[ADD] Stitches 설치 및 커스텀 버튼 생성 #2
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
저는 2번의 경우가 좋다고 생각합니다. 기본 CSS를 기반으로 variant를 확장해가야 한다고 생각하기 떄문입니다.
_document에 stiches ssr 설정도 추가해주세요 |
- 필요없는 대괄호 사용 제거 - size variants 옵션의 가독성 향상을 위해 줄임말 제거 - 관심사 분리를 위해 스타일 코드와 컴포넌트 코드를 분리
추후 디자인 시스템이 결정됨에 따라 config 옵션을 보완할 예정입니다.
세세한 리뷰 너무 감사드립니다. 가볍게 생각했던 것들을 다시 확인하면서 많이 배우네요😊 리뷰 남겨주신 내용 바탕으로 수정하고 커밋 했습니다! 부족한 부분이 있으면 말씀해주세요!! 궁금한 점이 있습니다!
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
파일 구조는 한번에 정리해서 오늘중으로 제안드리겠습니다
@@ -0,0 +1,52 @@ | |||
import { styled, VariantProps } from '@stitches/react'; | |||
|
|||
export const StyledButton = styled('button', { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest: StyledButton
을 쓰는 것은 앞으로 명명지을 때 좋은 방향은 아닌 것 같습니다. 그래서 2가지 제안을 드립니다.
- Stitches Component를 Component로 사용하기 위해 import 해올때는,
S
로 전체 import 해서 사용한다.
import * as S from './style';
- Component를 감싸는 Stitches Component에는
-Styled
또는-Base
를 뒤에 붙이는 것을 추천드립니다.
export const ButtonStyled = styled('button', {
// ...
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest:
StyledButton
을 쓰는 것은 앞으로 명명지을 때 좋은 방향은 아닌 것 같습니다. 그래서 2가지 제안을 드립니다.
- Stitches Component를 Component로 사용하기 위해 import 해올때는,
S
로 전체 import 해서 사용한다.import S from './style';
- Component를 감싸는 Stitches Component에는
-Styled
또는-Base
를 뒤에 붙이는 것을 추천드립니다.export const ButtonStyled = styled('button', { // ... }
확인했습니다. 1, 2번 모두 적용하여 수정하겠습니다!
추가로, style.tsx 파일에서 다음과 같이 미리 정의한 컴포넌트의 VariantsType을 export 하는 것에 대해서는 어떻게 생각하시나요? style 관련 파일에서 type을 export 하는 것이 관심사를 올바르게 분리하지 못한 것일 수 있다고 생각하여 질문드립니다!
export type ButtonVariantsType = VariantProps<typeof Button>;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
아래와 같이 type.ts를 분리하는 것이 좋아보입니다.
// type.ts
import { ComponentProps } from "react";
import { Button } from "./style";
export type ButtonProps = ComponentProps<typeof Button>;
그래서 파일 정리를 하자면, 각 Component의 하위에는 4개의 파일이 존재할 것 같습니다.
ComopnentName
├── index.stories.tsx # UI Component에서 필요로 합니다.
├── index.tsx # Component를 가지고 있는 파일입니다.
├── style.ts # Stitches Component를 작업하는 파일입니다.
└── type.ts # 해당 Component의 Type을 모아두는 파일입니다.
font가 적용되지 않은 것 같아요.
|
|
제 환경에서는 정상적으로 작동해서 에러가 발생한 줄 몰랐네요ㅠㅠ 혹시 어떤 상황에서 에러가 발생하는지 말씀해주실 수 있을까요? |
Question: // stitches.config.ts
const notoSansKr = Noto_Sans_KR({
subsets: ['latin'],
weight: ['400', '500', '700'],
});
export const { globalCss, getCssText } = createStitches({
theme: {
fonts: {
notoSansKr: `${notoSansKr.style.fontFamily}`,
},
},
});
// globalStyles.ts
export const globalStyles = globalCss({
'*': {
boxSizing: 'border-box',
padding: 0,
margin: 0,
fontFamily: '$notoSansKr',
},
}); |
node 버전은 20으로 올리니 해당 이슈 해결되긴 합니다. 혹시 node version 어떤거 사용하시나요? |
해당 부분 길어질 것 같으니 같이 내일 이야기 하시죠!! |
처음 핏을 맞추는 거라 리뷰가 길어지는데, 조금만 더 같이 화이팅 하시죠!! |
v18.16.1 사용 중입니다. 버전 변경할 때만 해도 가장 최신 LTS였는데, 확인해보니 지금은 v18.17.0이 최신 LTS네요! --
알겠습니다. 세세한 리뷰 덕분에 세팅만 했을 뿐인데도 시야가 넓어지는 듯합니다! 감사해요 내혁님!! |
실수로 PR 닫아버려서 reopen 했습니다 죄송해요ㅠㅠ 말씀해주신 내용 반영해서 수정하고 커밋했습니다! @jeongnaehyeok |
논의한 부분 수정해서 push 했습니다! |
📌 이슈 번호
✨ 구현한 내용
@stitches/react
설치📝 논의사항