next: various header alignment/bugfixes - #15915
Rubiks-boy wants to merge 9 commits into
Conversation
| return ( | ||
| <Combobox.Root | ||
| collection={collection} | ||
| // We search server-side, so disable Combobox's built-in filtering. |
There was a problem hiding this comment.
this comment seemed totally unrelated... I'm not sure why it's here. I looked thru the git blame to see if it previously applied to a different prop, but couldn't track it down.
I tested search behavior after, and everything seemed to still work fine/I didn't notice any weird filtering.
There was a problem hiding this comment.
You're probably right, I remember that Finn touched the search bar multiple times over the span of several PRs. Might be as easy as a "merge conflict whoopsie".
5e4e18a to
61956e6
Compare
gregorbg
left a comment
There was a problem hiding this comment.
I really love the attention to detail! It comes at a high price though, because you're adding a lot of manual padding all over the place.
It's not strictly a violation of our style guide, because you are referencing proper Chakra tokens and not "wild" hard-coded pixel values. But the sheer amount of Chakra tokens that you need to put in here and there and beyond, just makes me feel a tiny bit uncomfortable.
Instead of focussing on the individual components and giving every list item a padding, maybe could it make sense to "zoom out" layout-wise and apply the inner margins to the list's container instead?
I am not referencing a specific list in a specific file of your PR, rather the term "list" is just an arbitrary example of the container-and-items setting.
Unfortunately I cannot put my finger on a exact location, without digging very deep into your changeset. But just looking over the diff, I really have a gut feeling there's some "chicken and egg" thing going on where you're adjusting too much on the "bullet point" level and not enough on the "item container" level
| <HStack ps={3} pe={1.5} py={3} justifyContent="space-between"> | ||
| <HStack> | ||
| {!LIVE_RESULT_BETA && <WCALogo />} | ||
| {!LIVE_RESULT_BETA && <WCALogo mr={1} />} |
There was a problem hiding this comment.
| {!LIVE_RESULT_BETA && <WCALogo mr={1} />} | |
| {!LIVE_RESULT_BETA && <WCALogo me={1} />} |
There was a problem hiding this comment.
heh, valid given my other PR 😭
| return ( | ||
| <Combobox.Root | ||
| collection={collection} | ||
| // We search server-side, so disable Combobox's built-in filtering. |
There was a problem hiding this comment.
You're probably right, I remember that Finn touched the search bar multiple times over the span of several PRs. Might be as easy as a "merge conflict whoopsie".
| return ( | ||
| <Combobox.Root | ||
| collection={collection} | ||
| // We search server-side, so disable Combobox's built-in filtering. |
4900f8d to
94dc4a4
Compare
|
@gregorbg I think I got something a little bit cleaner. Semantically, I want to align things based on the button's text instead of the button's border box, and have the container's padding dictate how far we indent the button's text. Other component libraries accomplish this by applying negative margins to ghost buttons (e.g. Radix's button). But Chakra doesn't! I used this negative margin idea in |
| base: { | ||
| // Ensure hover/focus outlines don't get clipped when we hide overflow | ||
| content: { | ||
| mx: "-3", | ||
| px: "3", | ||
| }, |
There was a problem hiding this comment.
Adjusting this on the base level feels dangerous, because it affects every Collapsible anywhere in the code.
This may be the solution for all Collapsibles that we have thus far, but will it also work for all collapsibles in the future?
If you are confident that Yes, this will work, then is it something that should be reported to Chakra upstream? (Because if you really want to consciously apply it to any and all Collapsibles ever out there, then the original Chakra recipe might be wrong/off)
There was a problem hiding this comment.
Good catch! Yeah, this is actually really dangerous - I forgot that this affects width: 100% calculations, which turns out would have caused a small regression on /competitions.
at the risk of slightly duplicating some the props, I'm adding these props inline where they're actually needed
There was a problem hiding this comment.
Mh, this actually amounts to a pretty big and delicious copy/pasta. Do you know that Chakra supports boolean recipes, where you declare a variant with true as the string key, and the framework flips it into a boolean for you?
The point here is not (only) reusability fetishism, but also the fact that the recipe declaration grants you a very "natural" place to write code comments about why this recipe exists in the first place and how these negative values came to be
| <Button | ||
| asChild | ||
| variant="ghost" | ||
| variant={active ? "subtle" : "ghost"} |
There was a problem hiding this comment.
Hmmm, this active property is only used actively (no pun intended) once throughout the whole PR. It's in the "choose your language" dropdown menu to visually mark a button as "you are selected".
But as you can imagine, changing the variant of a button just to mark "is this option selected" is not really the intended use-case for variants. Perhaps something like a vertical Segmented Control is more suitable here?
I am nit-picking this because without the active toggle boolean, this whole thing could simply be turned into a recipe under theme.ts. So it might be worth investigating an alternative component for the locale picker for 10-15 minutes, and get the easy win of a mobileNav variant under the button recipe.
There was a problem hiding this comment.
👀 oops, this active prop was sort of slop that leaked in, didn't catch it 🤦
I think going segmented control could cause some weirdness with keyboard nav: if you use arrow keys, it immediately selects the new option, leading to the page reloading. For now, going to revert back to what's on main (which passes the variant inline), and add an extra aria-current attribute
There was a problem hiding this comment.
Lmk if you'd prefer turning into a recipe (and/or if you have a good idea for a name :P). I'm not sure how applicable it is outside of this one mobile nav situation, so not sure if that affects naming and/or whether to turn into a recipe.
There was a problem hiding this comment.
I think I'm coming around to your point that it doesn't need to be a recipe because this specific button only applies to one specific situation.
If someone finds this in six months though, and realizes "Oh this is just what I needed!" then there's a risk of reusing this component when it really should become a recipe.
There was a problem hiding this comment.
Makes sense! Maybe we can revisit if (or more likely when) that happens?
(I'm pretty sure there's some piece even more generalizable here, probably either:
- a boolean prop on ghost buttons that cancels out padding with negative margins
- some
buttonPadding="xs"|"sm"|"md"|...prop that lets us use a different button size's padding preset
but I might need to see a few more examples to know for sure :))
94dc4a4 to
9cc1a97
Compare
Uh oh!
There was an error while loading. Please reload this page.