-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Fix runtime error in Slider storybook #2488
Fix runtime error in Slider storybook #2488
Conversation
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2488 +/- ##
=======================================
Coverage 82.27% 82.27%
=======================================
Files 143 143
Lines 2979 2979
Branches 917 913 -4
=======================================
Hits 2451 2451
Misses 497 497
Partials 31 31 ☔ View full report in Codecov by Sentry. |
Chromatic Report🚀 Congratulations! Your build was successful! |
아예 controlled와 uncontrolled 스토리를 나누는 것은 어떨까요? Switch 의 예시를 참고하시면 될 것 같습니다. controlled -> value의 초기값을 주고 defaultValue 을 args로 제공하지 않고 이렇게 하면 value를 sanitize 할 필요도 없어질 것 같아요!
|
하지만 고민이 있어요.
그 뒤 스토리마다 변화하는 control이 있으면
추가적으로 arg를 설정해주는 방식이에요. |
export const Primary = {
args: {
value: [5],
},
} satisfies StoryObj<typeof meta>
export const Uncontrolled = {
args: {
defaultValue: [3, 7],
},
} satisfies StoryObj<typeof meta>
const meta: Meta<typeof Slider> = {
component: Slider,
argTypes: {
... // 생략
value: {
if: {
exists: true,
arg: 'value',
},
},
defaultValue: {
if: {
exists: true,
arg: 'defaultValue',
},
},
},
}
|
@yangwooseong 피드백 감사합니다.
이 예와 같이 어떤 arg에 상태에 따라 다른 arg를 조건부로 랜더링하는 걸로 알고 있어서 질문드립니다 |
저도 개발모드에서는 숨겨지는데 배포된 것을 보면 안숨겨지고 그대로 있어서요. 위에 댓글에 있는 스토리북 프리뷰를 보시면 확인가능합니다 로컬에서 배포해서 테스트 하려면 yarn workspace @channel.io/bezier-react storybook-build 명령을 활용하시면 됩니다 |
아! 배포환경을 생각 못했네요😅 fix한 커밋 로컬에서 테스트했고 잘 숨겨집니다! |
value: { | ||
if: { | ||
exists: true, | ||
arg: 'value', | ||
}, | ||
}, | ||
defaultValue: { | ||
if: { | ||
exists: true, | ||
arg: 'defaultValue', | ||
}, | ||
}, |
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.
👍
8c755e5
to
d2d545a
Compare
Self Checklist
Related Issue
close #2312
Summary
Details
First commit
Template
was the solution I thought of.array
in storybook requiresobject
input.decorator
. I'm not sure because I haven't tried it yet. We also need to discuss how to use this to receive input.argTypes
, but I don't know how. I couldn't find this in the docs.number[]
orundefined
, this func returns original value.object
, this func returns value of object.value
not 'defaultValue'.meta
of Slider such as width, min, max ...argTypes.if
.Breaking change? (Yes/No)
No
References
value
option ofSlider
component does not work in storybook #2312