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

Svelte: add repo popovers to repo name in header and in dynamic filters#62865

Merged
camdencheek merged 6 commits intomainfrom
cc/repo-popover-search-results
May 30, 2024
Merged

Svelte: add repo popovers to repo name in header and in dynamic filters#62865
camdencheek merged 6 commits intomainfrom
cc/repo-popover-search-results

Conversation

@camdencheek
Copy link
Member

This adds the RepoPopover hover info to the dynamic filters in the search sidebar (replacing the full repo name tooltip) and to the global header.

Test plan

screenshot-2024-05-22_14-30-16.mp4

@cla-bot cla-bot bot added the cla-signed label May 22, 2024
@camdencheek camdencheek force-pushed the cc/repo-popover-search-results branch from 5ed07ce to a22641e Compare May 22, 2024 19:00
Comment on lines 34 to 44
Copy link
Member Author

Choose a reason for hiding this comment

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

Extracted this into a new component to make it easier to create a slot with a default, but overridable, value.

Comment on lines 48 to 52
Copy link
Member Author

Choose a reason for hiding this comment

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

Renamed because I wanted a component named SectionItem now, so it makes sense to call this SectionItemData instead.

Comment on lines 127 to 145
Copy link
Member Author

Choose a reason for hiding this comment

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

We want to wrap the whole item in the popover, not just the repo name, because otherwise the popover placement varies depending on the length of the repo name.

@camdencheek camdencheek requested review from a team and taiyab May 22, 2024 19:04
@taiyab
Copy link
Contributor

taiyab commented May 29, 2024

The one on the repo header on the repo pages needs to be offset a little on Y-axis (down a little).

Copy link
Contributor

Choose a reason for hiding this comment

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

By the way, do we need to specify a key properly in this loop here?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think so since the array is immutable. But we should probably be explicit about it

Copy link
Contributor

Choose a reason for hiding this comment

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

I would add a hover state here, it's been a case that people don't understand that this H1 element is clickable, since we are going to have a popover element to this hover state also makes sense here IMO

Copy link
Member Author

Choose a reason for hiding this comment

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

Agree, but I think we should save this for the planned header redesign

@camdencheek camdencheek marked this pull request as draft May 29, 2024 20:13
@camdencheek camdencheek force-pushed the cc/repo-popover-search-results branch from 00ef510 to 02696ac Compare May 29, 2024 22:58
@camdencheek camdencheek requested a review from vovakulikov May 29, 2024 23:41
@camdencheek camdencheek marked this pull request as ready for review May 30, 2024 01:30
<SectionItem {item} {onFilterSelect}>
<slot name="label" slot="label" let:label let:value {label} {value} />
</SectionItem>
{#if $$slots.label}
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this if statement live within SectionItems tags here? Or this would break the default slot as well?

Copy link
Member Author

Choose a reason for hiding this comment

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

Unfortunately, it seems there's an edge case where slot rendering cannot be conditional within a component. So I had to copy the fully component in the conditional. Another thing that gets much nicer in svelte 5

@camdencheek camdencheek merged commit 376cc7a into main May 30, 2024
@camdencheek camdencheek deleted the cc/repo-popover-search-results branch May 30, 2024 14:04
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