Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Svelte: rev picker design updates and addition to commits page#63506

Merged
camdencheek merged 12 commits into
mainfrom
cc/commits-revision-selector
Jun 27, 2024
Merged

Svelte: rev picker design updates and addition to commits page#63506
camdencheek merged 12 commits into
mainfrom
cc/commits-revision-selector

Conversation

@camdencheek

@camdencheek camdencheek commented Jun 27, 2024

Copy link
Copy Markdown
Member

This cleans up the revision picker design, adds a copy button, and adds it to the file page.

Apologies for the big diff. I recommend reviewing with whitespace changes disabled.

Fixes SRCH-599
Fixes SRCH-460

Test plan

https://share.cleanshot.com/WlLhPqQd

@cla-bot cla-bot Bot added the cla-signed label Jun 27, 2024
@camdencheek camdencheek marked this pull request as ready for review June 27, 2024 03:28
@camdencheek camdencheek requested a review from a team June 27, 2024 03:28

@fkling fkling left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! 🙂

on:click={() => handleCopy()}
class="{buttonClass} copy-button hoverable-button"
>
<Icon icon={ILucideCopy} aria-hidden="true" --icon-size="1em" />

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW since you added .hoverable-button to both of these buttons, you can also move the --icon-size="1em" declaration to the class below (single place) instead of passing it directly to the component.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, thanks!

Comment on lines +412 to +413
> *:not(:first-child) {
> .btn:not(:first-child),
> *:not(:first-child) .btn {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously, for this to trigger, it required that there was no element between the button group and the button. However, tooltips add a display: contents wrapper to target. This same pattern is used elsewhere in this file.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved these up to a higher-level data loader so it can be used in the commits page.

Comment on lines -223 to -224
border-bottom: 1px solid var(--border-color-2);
margin: -0.75rem -0.75rem 0 -0.75rem;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got rid of the negative margins in favor of just adding padding in the appropriate places.

display: grid;
grid-template-rows: auto;
grid-template-columns: [title] auto [author] minmax(0, 10rem) [timestamp] minmax(0, 6rem);
grid-template-columns: [title] auto [author] minmax(0, 10rem) [timestamp] minmax(0, 8rem);

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Increased the max size of the timestamp column so we aren't always truncating it


.timestamp {
padding-right: 0.75rem;
justify-content: flex-end;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right-aligning the timestamp looks a bit nicer IMO, since then ago (which is the same on every line) lines up

Comment on lines +385 to +391
display: grid;
grid-template-columns: min-content 1fr;
grid-template-areas:
'collapse-button rev-picker'
'search-files search-files';
gap: 0.375rem;
padding: 0.5rem;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CSS changes here are mostly around using grid for the header rather than nested flexboxes.

Comment on lines +199 to +203
<Tooltip tooltip="{isCollapsed ? 'Open' : 'Close'} sidebar">
<button class="{sidebarButtonClass} collapse-button" on:click={toggleFileSidePanel}>
<Icon icon={isCollapsed ? ILucidePanelLeftOpen : ILucidePanelLeftClose} inline aria-hidden />
</button>
</Tooltip>

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This all got dramatically simpler by not using the Button component and just using getButtonClassName

Comment on lines +423 to +424
// Prevent double borders when buttons are next to each other
margin-left: calc(-1 * var(--btn-border-width));

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved this in here because the rule it was nested in before did not apply to buttons that were not direct children of the button group

@camdencheek

Copy link
Copy Markdown
Member Author

@fkling sorry, I left a bunch of breadcrumb comments and forgot to actually submit them 😄

@camdencheek camdencheek enabled auto-merge (squash) June 27, 2024 20:05
@taiyab

taiyab commented Jun 27, 2024

Copy link
Copy Markdown
Contributor

@camdencheek Great work!

Quick design comment: I'd rather stick to using a secondary (or whatever button the original one is) in this case. The outline button adds more visual noise and I'd rather it stand out a bit like before.

@camdencheek camdencheek merged commit 42990e1 into main Jun 27, 2024
@camdencheek camdencheek deleted the cc/commits-revision-selector branch June 27, 2024 22:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants