-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[Layout] Rebuild OptionList
with layout primitives
#7958
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
Conversation
size-limit report 📦
|
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.
Tophatted all the stories for OptionList at the breakpoints locally and all except the one with sections look visually the same, but I know you mentioned the extra spacing in the description 👍
It's probably worth confirming with @sarahill or @nayeobkim that the extra 4px is okay before merging this to the batch 3 branch.
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.
Code looks good but I think I'd prefer if we found a way to keep the same spacing. Plus 1 on waiting for UX before 🚢 ing
role={role} | ||
> | ||
{/* eslint-disable-next-line @typescript-eslint/ban-ts-comment */} | ||
{/* @ts-ignore OptionList allows string as role but Box doesn't. @TODO: remove string from OptionList in v11 */} |
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.
👍 Let's just make sure this is added to the v11 road map / issue / PR, whatever we have going for that
Another thing I think you could do is cast role as BoxProps['role']
or maybe as unknown as BoxProps['role']
and that way you wouldn't need 4 lines of comments. I'm fine with leaving it as is, maybe uglier is better for visibility
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's a branch for v11 #7597 so I'll go ahead and open a pr against it.
<ul className={styles.OptionList} role={role}> | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
// @ts-ignore OptionList allows string as role but Box doesn't. @TODO: remove string from OptionList in v11 | ||
<Box as="ul" role={role} padding="2"> |
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.
It seems like this is where the added space is coming from. Can we use isFirstOption
here to change the value like you did above?
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.
The added spacing only happens on sections where there's no title, that's the combination where there were overlapping margins.
I added a Bleed
to handle that and resolve the change in spacing. It feels hacky but at least it prevents the visual regression.
<Box | ||
as="ul" | ||
id={`${id}-${sectionIndex}`} | ||
role={role as BoxProps['role']} |
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.
Nice 💯
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.
I think the uglier version with all the comments is better for visibility. But we can ship either one.
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.
I do agree the one with all the comments was better for visibility to know to remove it but I'm okay with either version!
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.
🎉
WHY are these changes introduced?
Fixes #7952
WHAT is this pull request doing?
Updates
OptionList
to use new layout primitives.One small visual change with this update due to replacing
margin
withpadding
is a slight increase (4px
) in spacing when there are multiple sections in anOptionList
. I don't think the added complexity to keep this the same as current doesn't seem worth it, but happy to hear other thoughts.Update: Added a
Bleed
to resolve the spacing change. Feels hacky but prevents the visual change.