-
Notifications
You must be signed in to change notification settings - Fork 881
refactor: update the navbar to match the new designs #15964
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
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.
Looks good so far!
Close to approving this – I left a few comments, but nothing blocking. I just want to take the UI for a test drive to make sure I didn't miss anything
site/src/index.css
Outdated
@@ -70,4 +70,10 @@ | |||
* { | |||
@apply border-border; | |||
} | |||
|
|||
/** Related to https://github.com/radix-ui/primitives/issues/3251 */ |
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.
Could the comment also be updated to list what components rely on this patch?
/> | ||
); | ||
}); | ||
export const Button = forwardRef<HTMLButtonElement, ButtonProps>( |
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'm just now realizing: do we want the ref type to always be HTMLButtonElement
? I'm thinking about cases like this:
<Button asChild>
<a href="#">Not actually a button in the output</a>
</Button>
Where TypeScript will think it's a button, but the actual HTML node will be for an anchor. I'm not sure what properties are on one but not the other, but calling a button method that doesn't exist could blow up the app
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.
Only thing is, I'm not actually sure how you would add a generic ref type to forwardRef, since it's just a function call, and not a full function signature
I don't think this is worth blocking over, but I'll try to figure out a fix next week
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 your concern is totally valid, but this is the default implementation from the shadcn/ui Button. I’d be open to changing it only if necessary, as I’d prefer not to add complexity without bringing justifiable value to us.
); | ||
}, | ||
); | ||
Button.displayName = "Button"; |
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 know there were some conversations about getting rid of displayName
, but we weren't sure if it was necessary for forwarded anonymous components. Does the component not get a name in the dev tools if the name isn't set here?
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.
Ah, okay, I wasn’t aware of that. Thanks for letting me know! I’ve just been copying and pasting the default implementation and making changes only when necessary.
proxies: Proxies, | ||
latencies: ProxyLatencies, | ||
) { | ||
return [...proxies].sort((a, b) => { |
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.
Could we get away with replacing this with a call to .toSorted
?
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.
close={open} | ||
/> | ||
</div> | ||
<button |
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.
Is there a reason why we're still using the default HTML button here, instead of adding a new variant to the Button
component?
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.
This button style isn’t used anywhere else, so I’d avoid creating a new variant (essentially an abstraction) for just a single use case. If we encounter more use cases like this in the future, I think that would be the right time to turn it into a variant.
@@ -26,7 +25,7 @@ describe("Navbar", () => { | |||
await userEvent.click(deploymentMenu); | |||
await waitFor( | |||
() => { | |||
const link = screen.getByText(Language.audit); | |||
const link = screen.getByText("Audit Logs"); | |||
expect(link).toBeDefined(); |
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.
Is this check needed since getByText
will throw if a node can't be found?
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.
You’re right, it’s not needed.
@@ -26,7 +25,7 @@ describe("Navbar", () => { | |||
await userEvent.click(deploymentMenu); | |||
await waitFor( | |||
() => { | |||
const link = screen.getByText(Language.audit); | |||
const link = screen.getByText("Audit Logs"); |
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.
Could we update these to be role selectors, too?
open: "text-content-primary", | ||
}; | ||
|
||
type MobileMenuProps = MobileMenuPermissions & { |
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.
Nit: could this be moved below MobileMenuPermissions
? When I was reading this top to bottom, I had to do a double take to see where the permissions were defined
export interface DropdownMenuButtonProps | ||
extends ComponentPropsWithoutRef<typeof Button> {} | ||
|
||
export const DropdownMenuButton = forwardRef< |
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'm wondering if it's a little confusing to have a file export both a trigger and a button, especially since the button doesn't use the trigger internally
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.
Hm... I hadn’t thought of that 🤔. Honestly—maybe it’s just personal—I don’t see any confusion since a trigger is a behavioral component and a button is a visual component. To me, it feels okay to have both. What would you suggest?
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.
@BrunoQuaresma It looks like you are adding DropdownMenuButton to the shadcn DropdownMenu component? Im curious why it is necessary to add this?
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 purpose of this component is to make dropdown button styling consistent. For example, instead of composing a Button
+ Icon
+ styling in every component or page where you want to add a dropdown, you could use a consistent component to reduce boilerplate. While I don’t mind boilerplate in general, in this case, since we already have a consistent design, it could help avoid inconsistencies.
Before:
<Button ref={ref} variant="outline">
Admin settings
<DropdownMenuChevronDown />
</Button>
After:
<DropdownMenuButton>Admin settings</DropdownMenuButton>
However, while writing this, I thought of another approach that might be better—creating a new dropdown
variant in the Button
component:
<Button ref={ref} variant="dropdown">
Admin settings
</Button>
Thoughts?
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.
If every DropdownMenu component will always use the DropdownMenuButton with this styling then it could make sense. However. that may not always be the case. I personally like having a dropdown variant for the button component more than altering the DropdownMenu component.
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 decided to remove the DropdownMenuButton
component for now until we actually need it.
}} | ||
> | ||
Workspace proxy settings: | ||
<span className="leading-[0px] flex items-center gap-1"> |
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 don't think we want to set the line height to 0. It'll cause a lot of text rendering issues the moment the text has to wrap around
99% sure we want to set this to leading-none
to set the text solid (line height of 1)
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.
Noted! I’m not sure why, but when I used a line height of 1, it was misaligned, and I only managed to fix it by setting it to 0. I’ll double-check that.
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.
Quick notes from testing things out:
- Do we want to add
overflow-x: auto
toNavItems
? That way if the viewport shrinks enough on mobile, the user can still scroll to the page link that they want - I also feel like the new navbar feels a little off with the rest of the site. The navbar and the sub-navigation below it are just different enough to be noticeable, while still similar enough to make it feel like it wasn't intentional

I posted a comment on the Figma design, but I really can't help but feel like the blurred background is a mistake. The comment goes into more detail, but I think a solid background is way less disorienting
Screen.Recording.2024-12-27.at.12.37.22.PM.mov
Still, I'm going to approve. We can always update the design in a second pass once Christin is back
I don’t think so—or at least, I wouldn’t expect that. What viewport did you use? If it’s something under 360px, I think we can safely skip it since that’s not very common these days. Reference: Common Screen Resolutions
Good catch, I’ll fix that 👍.
Ahhh, you’re right. I definitely prefer the solid background over the blurry one, but let’s let @chrifro make the final decision on it. cc.: @Parkreiner |
Update the navbar to match the designs in this Figma file. Related to #15617.
Desktop preview:
Screen.Recording.2024-12-27.at.12.13.38.mov
Mobile preview:
Screen.Recording.2024-12-27.at.12.12.42.mov
For a closer look, you can check Chromatic snapshots or test the changes locally.
A few considerations: