Uh oh!
There was an error while loading. Please reload this page.
Add stickyTop prop to PageLayout.Pane - #2232
Conversation
🦋 Changeset detectedLatest commit: 0adf6b0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
size-limit report 📦
|
a59d85a to
515992aCompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Amazing work, @broccolinisoup! 💖 Thank you for taking this on.
Left a couple of minor comments but I don't see any blockers. Feel free to merge this when you feel ready 🚢
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| name="stickyTop" | ||
| type="number | string" | ||
| defaultValue="0" | ||
| description="Use stickyTop to push the sticky pane down to make room for a sticky header if necessary" |
There was a problem hiding this comment.
Should we add into the description that if it is number, we expect px and if it is string value with units?
There was a problem hiding this comment.
Done! 800b3ec let me know if you have a better wording :)
| calculatedHeight = `calc(100vh - ${Math.max(topOffset, stickyTopHeight) + bottomOffset - overflowScroll}px)` | ||
| const stickyTopWithUnits = typeof stickyTop === 'number' ? `${stickyTop}px` : stickyTop | ||
| calculatedHeight = `calc(100vh - (max(${topOffset}px, ${stickyTopWithUnits}) + ${bottomOffset}px - ${overflowScroll}px))` |
| }} | ||
| > | ||
| <Heading>Sticky top content</Heading> | ||
| Custom sticky header |
There was a problem hiding this comment.
Ah this is very explanatory. Thanks for updating it!
Co-authored-by: Cole Bemis <colebemis@github.com>
Co-authored-by: Cole Bemis <colebemis@github.com>
| name="stickyTop" | ||
| type="number | string" | ||
| defaultValue="0" | ||
| description="Use stickyTop to push the sticky pane down to make room for a sticky header if necessary. Use the type `string` to specify the height with a unit i.e. 5rem; otherwise the type `number` will be taken as px." |
There was a problem hiding this comment.
Could you copy this prop documentation and With custom sticky header example into the SplitPageLayout.mdx page as well?
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hi! Sorry, late to the party, how do you feel about calling the prop 1.<PageLayout.Paneposition="start"stickyoffset={64}>// because you use it with the sticky prop, ↑ i like this one the most2.<PageLayout.Paneposition="start"stickyoffsetTop={64}>// this is a close second for explicit direction3.<PageLayout.Paneposition="start"stickyoffsetHeader={64}>// i lowkey like this one because it tells you offset from what4.<PageLayout.Paneposition="start"stickystickyOffset={64}>// stick-offset is bit redundant when used with sticky, but more clear5.<PageLayout.Paneposition="start"stickystickyOffsetTop={64}>// this is the most clear we can be 😅 also the most verbose |
colebemis
commented
Aug 22, 2022
I like the word "offset" 👍 I think |
broccolinisoup
commented
Aug 22, 2022
I like
I am just now thinking we weren't super explicit about stickyTop needs sticky prop to work on the docs. Maybe we should mention that they need to be used together? |
Happy with
It's not super clear, we can make it more explicit with
- <PageLayout.Pane position="start" offsetTop={64} sticky>+ <PageLayout.Pane position="start" sticky offsetTop={64}>
Yes good point! We should add that to the prop description of offsetTop |
broccolinisoup
commented
Aug 24, 2022
Good call to improve the docs! I created a PR to get the feelings of the new name with the improved docs. Let me know what you think 😊 |
Closesthis issue which lives in the internal repo.
Motivation
This PR adds a prop called stickyTop to the PageLayout.Pane to be able to push the pane down and make space for the top sticky element (which lives outside of the PageLayout component) and sticks the pane to a position where the top element ends.
Screen record
StickyTop.on.PageLayout.Pane.1.mp4
Merge checklist
Take a look at the What we look for in reviews section of the contributing guidelines for more information on how we review PRs.