-
Notifications
You must be signed in to change notification settings - Fork 1
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
[Feature] component 페이지 마크업 (avatar, checkbox, switch, header) #197
base: main
Are you sure you want to change the base?
Conversation
|
Size Change: 0 B Total Size: 680 kB ℹ️ View Unchanged
|
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.
마크업 작업하시느라 수고 하셨습니다!!
Checkbox 와 Switch pressed hover 관리 여부 같은 경우에는 data 속성을 전달하면 컴포넌트를 새로 만들지 않아도 컴포넌트단 제어는 가능할 거 같아요~
- Checkbox
checkbox 컴포넌트의 pressed 의 상태는 Checkbox 내부에 input 태그에 data-pressed 속성을 주면 pressed 상태를 표현할 수 있는데요,
현재 checkbox input 에 접근하기 위해서는 ref 를 전달해서 ref.current 로 요소를 가져와서 data attribute 를 전달할 수 있을 거 같아요.
const inputRef = useRef<HTMLInputElement>(null);
useEffect(() => {
if (inputRef.current) {
inputRef.current.setAttribute("data-pressed", "true");
}
}, []);
- Switch
Switch 컴포넌트는 label 태그에 data 속성을 전달해야 하는데요, 현재 ref 가 input 태그에 전달되고 있어서 label 에 접근하기는 어려울 거 같아요. 🤔
document.querySelector
로 label 요소를 가져와야될 듯 한데 아래 방법처럼 돔에 접근하는 방식으로 구현해보는 건 어떨까요?
useEffect(() => {
//label for 속성으로 요소 가져오기
const labelElement = document.querySelector('label[for="example id"]');
if (labelElement) {
labelElement.setAttribute("data-hover", "true");
}
}, []);
<Switch inputProps={{ id: "example id" }} />
- pressed, checked, disabled에 맞게 구현 - 코드리뷰에 나온 내용을 토대로 useRef를 사용해서 attribute 추가
- querySelector로 요소를 조작하는 방식을 사용 - disabled의 경우 Switch 컴포넌트가 disabled와 checked가 공존하기 힘들기에 컴포넌트 따로 제작
- GDGoC로 바뀐 내용 반영 - 디자이너님과 이야기하여 PC, Mobile 순서 변경
화면이 980px 이상일 때, 아래 사진과 같이 Header의 좌우 여백에 padding 공간이 없는 이유가 xsToLg: {
paddingX: "16px",
height: "66px",
}, 지금 개발팀 활동 안하고 계시는 홍서현님이 작성하신 코드이긴 한데 관련 이슈는 파두었습니당~ |
apps/wow-docs/app/component/switch/_components/ComponentTab.tsx
Outdated
Show resolved
Hide resolved
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.
Lgtm👍
🎉 변경 사항
🙏 여기는 꼭 봐주세요!
componentTab
에서 지금 당장 구현하기 어려운 부분은 이미지 파일로 덮어놓은 상태입니다.GuidelineTab
에서 아직 GDSC -> GDGoC로 되지 않은 상태입니다. 디자인팀께 요청드린 상태라서 피그마 바뀌면 업데이트하겠습니다.