-
Notifications
You must be signed in to change notification settings - Fork 48
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
Implement Slider component #871
Conversation
🦋 Changeset detectedLatest commit: 89c62cf The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codecov ReportBase: 71.00% // Head: 71.08% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## next-v1 #871 +/- ##
===========================================
+ Coverage 71.00% 71.08% +0.07%
===========================================
Files 204 206 +2
Lines 2894 2953 +59
Branches 807 818 +11
===========================================
+ Hits 2055 2099 +44
- Misses 721 736 +15
Partials 118 118
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
https://github.com/channel-io/ch-desk-web/pull/10917 |
Chromatic Report🚀 Congratulations! Your build was successful! |
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 default interface SliderProps extends | ||
BezierComponentProps, | ||
SliderPrimitiveProps, | ||
SliderOptions {} |
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.
TODO: hasError, readOnly prop 지원되면 좋을 것 같습니다. (FormComponentProps
)
packages/bezier-react/src/components/Forms/Inputs/Slider/Slider.tsx
Outdated
Show resolved
Hide resolved
packages/bezier-react/src/components/Forms/Inputs/Slider/Slider.tsx
Outdated
Show resolved
Hide resolved
…es onpointer(down|up)
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.
👍
Forms/Inputs/
하위보단 Forms/
하위가 적절할 거 같아요. 정의가 애매모호하긴한데, 지금은 Inputs
하위엔 텍스트 입력기와 스타일을 공유하는(Select) 컴포넌트만 위치해뒀습니다.
packages/bezier-react/src/components/Forms/Inputs/Slider/Slider.types.ts
Outdated
Show resolved
Hide resolved
packages/bezier-react/src/components/Forms/Inputs/Slider/Slider.test.tsx
Outdated
Show resolved
Hide resolved
packages/bezier-react/src/components/Forms/Inputs/Slider/Slider.styled.ts
Outdated
Show resolved
Hide resolved
import { styled, css } from 'Foundation' | ||
import { toLength } from 'Utils/styleUtils' | ||
import DisabledOpacity from 'Constants/DisabledOpacity' | ||
import { focusedInputWrapperStyle } from 'Components/Forms/Inputs/mixins' |
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.
만약 포커스 디자인이 TextField, TextArea, Select 외에도 범용적으로 사용된다면 Forms/ 디렉토리 하위로 이동해야할 거 같네요 🤔
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.
mixins
안에 focusedInputWrapperStyle
, erroredInputWrapperStyle
이 두 개는 input
외에도 다른 컴포넌트에 사용할 수 있을 것 같아서, 후속 PR에서 input
에 사용되는 믹스인과 그렇지 않은 것을 분리하고 적용해야 할 것 같습니다.
Summary
Slider
컴포넌트를 구현합니다.Details
Preview
onValueChange
핸들러 호출 상황을 볼 수 있습니다.Kapture.2022-09-21.at.14.21.50.mp4
input
의disabled
상태를 보여줍니다. 해당 상태에서는 핸들러가 trigger되지 않으며, 키보드 내비게이션이 되지 않습니다.cursor
는not-allowed
,opacity
는 Bezier의DisabledOpacity
를 가집니다.Slider
는guide?: number[]
prop이 제공되면 이에 따라 해당하는 value의 위치에 가이드 눈금을 표시합니다.Kapture.2022-09-21.at.14.24.50.mp4
minStepsBetweenThumbs
prop으로 Thumb 두 개가 하나의 value에 겹치지 않도록 할 수 있습니다. 키보드 내비게이션으로는 한 thumb가 다른 thumb를 넘어갈 수 없으며, 마우스 드래그로는 가능합니다. thumb가 넘어가더라도 (Slider의 왼쪽 thumb와 오른쪽 thumb가 달라지더라도)value
는 오름차순을 유지합니다.Kapture.2022-09-21.at.14.26.10.mp4
Future works
guide
prop에 따른 Guide 눈금의 위치에 대한 단위 테스트를 작성해야 합니다.Slider.styled.ts
의calculateGuideLeftPosition
참고). 추후에 위치 계산 로직을 더 간소화/추상화할 수 있다면 그렇게 하고 단위 테스트를 작성하면 좋겠습니다.Browser Compatibility
OS / Engine 호환성을 반드시 확인해주세요.
Windows
macOS
References