-
Notifications
You must be signed in to change notification settings - Fork 2
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
Revamp core components storybook doc(pt. 4) #249
Revamp core components storybook doc(pt. 4) #249
Conversation
Anchored popover has wrong `top` position after we migrate to new addon-docs. Needs investigation.
> | ||
<Button | ||
basic="Open popover" | ||
onClick={handlePopoverOpen} /> |
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.
我在本機端按 Open popover
沒有打開 popover 耶
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.
拍謝 PR description 寫不夠清楚 XD" 其實有但它的 top
跑到下面去了。會在下一個 PR 修掉。
Anchored popover is a <Popover> wrapped with two HOCs: `closable()(anchored()(Popover)` Before this commit it will form following DOM structure: ```html <body> <div class="gyp-base-layer"> <div class="gyp-closable> <div class="gyp-popover gyp-popover--top"> </div> </div> </body> ``` `gyp-popover` is absolutely positioned, with `top` value which is relative to its document top left corner. `gyp-closable` is `position: fixed` with `width: 100vw` and `height: 100vh`. It works when document is too short to scroll, such as previous storybook doc canvas. But when the element triggering popover is over the screen(i.e. we have to scroll to click it), the position of anchored popover will be wrong because the `position: absoulte` of `gyp-popover` is relative to `gyp-closable`, which is `position: fixed`, so the `top` value is wrong. The position of `gyp-popover` should always be relative to the document. So in this fix we change the `closable` HOC code to change DOM structure as: ```html <body> <div class="gyp-base-layer"> <div class="gyp-closable" /> <div class="gyp-popover" /> </div> </body> ``` Let the `gyp-popover` be relative to `gyp-base-layer`, which is absolute to `document.body`. Note that this bug won't happen on Cloud2 since on Cloud2 the `document.body` height is always `100vh`, which is not scrollable.
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 overall 👍
export default { | ||
title: '@ichef/gypcrete|List', | ||
component: List, | ||
subcomponents: { ListRow }, |
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.
Maybe also adds Section
to props table?
title: '@ichef/gypcrete|Popover', | ||
component: PurePopover, | ||
subcomponents: { | ||
'renderToLayer(closable(anchored(Popover))': Popover, |
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.
No props found for this component
I think that's because renderToLayer()
HOC does not contain any prop type. We might need other ways to get those prop types out.
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.
Open an asana ticket: https://app.asana.com/0/347798529122928/1161326694404681
…ew-storybook Fix anchored popover top position when document is scrollable
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
Purpose
Same as #246 but for
<List>
,<Popover>
,<Popup>
,<SearchInput>
,<Section>
.Some side notes:
<Popover>
will show with incorrecttop
position in new storybook doc. I'll try to look into it in next PR.<Popup>
example since popups as closable and default to closed because they will block the doc.Changes
List
,Popover
,Popup
,SearchInput
,Section
.Risk
None.
TODOs