-
Notifications
You must be signed in to change notification settings - Fork 8
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
[FE] 공용 토글 버튼 컴포넌트 구현 #158
Conversation
Test Results5 tests 5 ✅ 3s ⏱️ Results for commit 51d19f4. ♻️ This comment has been updated with latest results. |
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.
낙타~~ 빠르게 구현해 주셨군요!! 고생 많으셨습니다🤸♀️
|
||
export const s_input = css` | ||
position: absolute; | ||
left: -1000%; |
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.
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.
맞아요~! 해당 토글 버튼은 label에서 작용하도록 구현했어요!
빙봉 말대로 주석으로 간략한 설명을 남겨두면 더욱 좋겠네요! 의견 감사해요~! 🙌
|
||
interface ToggleButtonProps { | ||
id: string; | ||
isClicked: boolean; |
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.
[P3]
isClicked
대신 isToggled
어떤가요?
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.
좋습니다! 이걸로 하면 더욱 직관적이겠네요!
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.
[P3]
Button
관련된 컴포넌트들은
components/_comoon/Button
디렉터리 하위에 위치시키는 것은 어떨까요?
ex)
components/_common
ㄴ Button
ㄴ BaseButton
ㄴ ToogleButton
ㄴ NavigateButton
ㄴ AuthButton
ㄴ HomeButton
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.
현재 공통 컴포넌트로 구현한 버튼이 수정사항이 생겨서 기존 Button의 이름을 그대로 사용하게 되었는데요..!
그래서 Button 하위에 두기엔 이미 존재하는 Button 컴포넌트가 있어서 애매한 느낌이 있는 것 같습니다.
이름 자체는 매우 비슷하지만, 내부 구현되어 있는 로직이 다르기도 해서 파생상태가 아니다 보니 폴더구조를 어떻게 잡아야할지 현재는 감이 오지 않네요!!
현재는 여러 버튼이 존재하기보다는 기존의 Button으로 디자인이 충분히 가능할 것이라는 생각도 들어서 더이상 Button 관련된 컴포넌트가 생길까 싶기도 한 생각이 듭니다!
기존의 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.
현재 구현한 Button(=index.tsx)을 BaseButton으로 네이밍을 변경하고
ToggleButton을 Button 디렉터리 내로 이동시키는건 어떨까요?
지금 구조는 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.
토글 버튼 만든다고 고생했씁니다 낙타!!!
간단한 코멘트 달았는데, RC를 날릴까 하다가 사소한 것이라서 반영해도, 안해도 크게 문제가 되지 않을 것이라 판단해 코멘트로 요청합니다 ㅎㅎ
align-items: center; | ||
gap: 1.2rem; | ||
align-items: center; | ||
|
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.
[Comment]
린트가 적용이 안되다가, typography 관련 문제가 해결되어 다시 적용된 것일까요~?
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.
그것은 다른 컨텍스트인데, 명령어로 npm run lint:css
입력했더니 요게 적용 안되있었는지 적용되었습니다! 추가로 적용했어요! 🙌
<div css={s_container}> | ||
{children} | ||
<label htmlFor={id} onClick={onClick} css={s_buttonContainer(isClicked)}> | ||
<span css={s_switch}>선택</span> |
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.
[Q]
선택
이라는 텍스트의 스타일이 display : none
인데, 보이지 않게 하는 요소에 텍스트를 추가한 이유가 있을까요~? 웹 접근성을 위해서라면, aria-label
등 html 어트리뷰트를 활용하면 좋을 것 같아요!
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.
먼저 좋은 질문 감사합니다 해리 👍
저번에 하루와 aria-label과 일반 label에 대해서 대화를 나눈 기억이 있었는데, aria-label은 일부 스크린 리더에는 지원이 안된다고 하셨던 기억이 나서 관성적으로 사용을 안했던 것 같네요 😅. 직접 확인해보고자 찾아봤는데 아직 관련 레퍼런스는 찾지 못했습니다.
그래서 구글 스크린리더 익스텐션을 설치해서 테스트해봤는데 정상적으로 잘 동작하네요! aria-label로 이용하면 좋을 것 같습니다!
깊게 연관된 것은 아니지만 관련 자료 함께 남겨드려요!
https://bootcamp.uxdesign.cc/when-to-use-aria-label-or-screen-reader-only-text-cd778627b43b
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.
탐구 정신 미쳤다 송재석...
<label htmlFor={id} onClick={onClick} css={s_buttonContainer(isClicked)}> | ||
<span css={s_switch}>선택</span> | ||
</label> | ||
<input type="checkbox" id={id} checked={isClicked} css={s_input} /> |
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.
[Comment]
토글 버튼은 input 태그를 활용해서 만들 수 있겠군요... 한 번도 만들어보지 않은 컴포넌트라서 인풋 태그를 사용해서 만든다는 것을 처음 알았네요...! 웹 접근성을 위해서 해당 태그를 활용한다고 보면 될까요?? (궁금궁금)
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.
원래는 저도 button 태그로 이용해보려 생각을 했습니다!
그런데 checkbox
로 이용하게 되면 어차피 checked
프로퍼티는 항상 true
, false
값을 가지기 때문에 해당 체크박스로 구현하는 것이 더욱 좋을거라고 판단했습니다 :)
특별하게 웹 접근성을 고려한 것은 아니고 취향차이인 것 같아요 :)
export const False: Story = { | ||
args: { | ||
id: 'toggle-button', | ||
isClicked: false, | ||
onClick: () => {}, | ||
}, | ||
}; | ||
|
||
export const True: Story = { | ||
args: { | ||
id: 'toggle-true-button', | ||
isClicked: true, | ||
onClick: () => {}, | ||
}, | ||
}; |
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.
[P3]
False, True로는 어떤 UI가 그려질지 예상하기 힘든 것 같습니다...!
그래서 스토리 이름을 Toggled, UnToggled로 변경해보는 것은 어떨까요~? :)
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.
너무 좋습니다! 제안 감사합니다~!
title: 'Components/ToggleButton', | ||
component: ToggleButton, | ||
tags: ['autodocs'], | ||
decorators: [ |
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.
[Comment]
데코레이터 활용 좋습니다!!
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.
수정사항 반영해서 답글 남겼습니다 :) 확인 후 재검토 부탁드려요~ 🐫
align-items: center; | ||
gap: 1.2rem; | ||
align-items: center; | ||
|
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.
그것은 다른 컨텍스트인데, 명령어로 npm run lint:css
입력했더니 요게 적용 안되있었는지 적용되었습니다! 추가로 적용했어요! 🙌
export const False: Story = { | ||
args: { | ||
id: 'toggle-button', | ||
isClicked: false, | ||
onClick: () => {}, | ||
}, | ||
}; | ||
|
||
export const True: Story = { | ||
args: { | ||
id: 'toggle-true-button', | ||
isClicked: true, | ||
onClick: () => {}, | ||
}, | ||
}; |
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.
너무 좋습니다! 제안 감사합니다~!
|
||
export const s_input = css` | ||
position: absolute; | ||
left: -1000%; |
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.
맞아요~! 해당 토글 버튼은 label에서 작용하도록 구현했어요!
빙봉 말대로 주석으로 간략한 설명을 남겨두면 더욱 좋겠네요! 의견 감사해요~! 🙌
|
||
interface ToggleButtonProps { | ||
id: string; | ||
isClicked: boolean; |
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.
좋습니다! 이걸로 하면 더욱 직관적이겠네요!
<div css={s_container}> | ||
{children} | ||
<label htmlFor={id} onClick={onClick} css={s_buttonContainer(isClicked)}> | ||
<span css={s_switch}>선택</span> |
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.
먼저 좋은 질문 감사합니다 해리 👍
저번에 하루와 aria-label과 일반 label에 대해서 대화를 나눈 기억이 있었는데, aria-label은 일부 스크린 리더에는 지원이 안된다고 하셨던 기억이 나서 관성적으로 사용을 안했던 것 같네요 😅. 직접 확인해보고자 찾아봤는데 아직 관련 레퍼런스는 찾지 못했습니다.
그래서 구글 스크린리더 익스텐션을 설치해서 테스트해봤는데 정상적으로 잘 동작하네요! aria-label로 이용하면 좋을 것 같습니다!
깊게 연관된 것은 아니지만 관련 자료 함께 남겨드려요!
https://bootcamp.uxdesign.cc/when-to-use-aria-label-or-screen-reader-only-text-cd778627b43b
<label htmlFor={id} onClick={onClick} css={s_buttonContainer(isClicked)}> | ||
<span css={s_switch}>선택</span> | ||
</label> | ||
<input type="checkbox" id={id} checked={isClicked} css={s_input} /> |
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.
원래는 저도 button 태그로 이용해보려 생각을 했습니다!
그런데 checkbox
로 이용하게 되면 어차피 checked
프로퍼티는 항상 true
, false
값을 가지기 때문에 해당 체크박스로 구현하는 것이 더욱 좋을거라고 판단했습니다 :)
특별하게 웹 접근성을 고려한 것은 아니고 취향차이인 것 같아요 :)
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.
현재 공통 컴포넌트로 구현한 버튼이 수정사항이 생겨서 기존 Button의 이름을 그대로 사용하게 되었는데요..!
그래서 Button 하위에 두기엔 이미 존재하는 Button 컴포넌트가 있어서 애매한 느낌이 있는 것 같습니다.
이름 자체는 매우 비슷하지만, 내부 구현되어 있는 로직이 다르기도 해서 파생상태가 아니다 보니 폴더구조를 어떻게 잡아야할지 현재는 감이 오지 않네요!!
현재는 여러 버튼이 존재하기보다는 기존의 Button으로 디자인이 충분히 가능할 것이라는 생각도 들어서 더이상 Button 관련된 컴포넌트가 생길까 싶기도 한 생각이 듭니다!
기존의 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.
리뷰 반영 고생하셨습닏~~
@@ -30,25 +30,25 @@ export default meta; | |||
|
|||
type Story = StoryObj<typeof meta>; | |||
|
|||
export const False: Story = { | |||
export const UnToggled: Story = { |
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.
👍👍👍
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.
현재 구현한 Button(=index.tsx)을 BaseButton으로 네이밍을 변경하고
ToggleButton을 Button 디렉터리 내로 이동시키는건 어떨까요?
지금 구조는 Button 속성을 띈 컴포넌트들이 흩어져있다는 느낌이 들어요🥲
e2dd173
to
51d19f4
Compare
관련 이슈
작업 내용
https://paper-mass-5ff.notion.site/47545046f8414544aa193d164d9ed578?pvs=4
작업 내용 및 특이사항 노션에 기록해두었습니다 :)
특이 사항
리뷰 요구사항 (선택)
isClicked
라는 네이밍이 살짝 어색하게 느껴지는데 다른 의견 있으면 자유롭게 부탁드립니다! 🙇♂️