tailwindcss 동적 스타일링 관련 문제 #39
Replies: 3 comments 1 reply
-
저는 style속성 사용하는 게 좋을 것 같아요 |
Beta Was this translation helpful? Give feedback.
-
저도 Spacer 컴포넌트를 구현하면서 같은 문제가 있었어요! variants에 모든 값을 일일이 등록하자니 번거로운 것 같고, 일부 값만 사용한다면 너무 제한적이라는 생각이 들더라구요. |
Beta Was this translation helpful? Give feedback.
-
저도 제가 생각하기에 정해진 값으로만 하는 것은 제한적인 느낌이 들 것 같아서 자유도를 넓히려면 지금 하신대로 하는게 맞다고 생각합니다. 공식문서에서 제안한 방법이 아니라는 것은 혹시 성능의 문제가 생겨서 고민이 되시는 걸까요? 그게 아니라면 앞서 준혁님이 말씀하신대로 생각하면 될 것 같아요 |
Beta Was this translation helpful? Give feedback.
-
안녕하세요 여러분. discussions 탭을 처음 사용하게 되었네요ㅎㅎ
다름이 아니라 Group 컴포넌트를 개발하다가 동적 스타일링과 관련하여 문제가 생겨 의논하고자 글을 남깁니다.
테일윈드는 빌드 시 테일윈드 클래스네임을 모두 css 코드로 파싱하는데, 제가 작성한 코드는 런타임에 동적으로 클래스네임을 생성하고 있기 때문에 제대로 작동하지 않습니다. 그래서 보시는 것처럼 style 속성을 활용하여 스타일을 넣어주었어요. 근데 이게
v2
에서는 권장하는 방식이었지만v3
로 업데이트 되면서 공식문서에서도 찾아볼 수 없는 거 보니 권장하는 방식은 아닌가봐요.그렇다고 딱 정해진 값으로만 spacing을 조절하도록 하는 건 너무 제한적이지 않을까 싶은 생각이 자꾸만 들어 같이 이야기해서 방법을 정하면 좋을 것 같습니다. 제가 생각한 방법은 다음과 같아요.
sm
,md
,lg
등 우리가 미리 정의한 variant로만 사용한다.<Component color="bg-blue-500" spacing="gap-5" />
)꼭 한 번씩 읽어보시고 의견 남겨주세요! @Heeeera @oridori2705 @mibu119 @HY219
Beta Was this translation helpful? Give feedback.
All reactions