Skip to content
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

Simplify hover detection #890

Merged
merged 2 commits into from
Jun 6, 2024
Merged

Conversation

victorlin
Copy link
Member

@victorlin victorlin commented Jun 3, 2024

preview

Description of proposed changes

  • Use CSS hover selector instead of relying on a prop
  • Limit the scope of ResourceLinkWrapper to just adding shift-click behavior

Related issue(s)

N/A, thought of this while working on #874

Checklist

  • Checks pass
  • Hover still changes text color on quick links and individual resources
  • Shift+click still opens modal for quick links and individual resources
  • Check if changes affect the resource index JSON revision

@victorlin victorlin self-assigned this Jun 3, 2024
@nextstrain-bot nextstrain-bot temporarily deployed to nextstrain-s-victorlin--kg9kva June 3, 2024 23:20 Inactive
@victorlin victorlin temporarily deployed to nextstrain-s-victorlin--kg9kva June 3, 2024 23:22 Inactive
@victorlin victorlin marked this pull request as ready for review June 3, 2024 23:23
@victorlin
Copy link
Member Author

Tagged @jameshadfield as author of these lines and @genehack in case you're interested in front-end work related to #870

@victorlin victorlin force-pushed the victorlin/simplify-hover-detection branch from 2777903 to b051baf Compare June 5, 2024 18:44
@victorlin victorlin temporarily deployed to nextstrain-s-victorlin--kg9kva June 5, 2024 18:45 Inactive
victorlin added 2 commits June 5, 2024 16:05
- Use CSS hover selector instead of relying on a prop
- Limit the scope of ResourceLinkWrapper to just adding shift-click
  behavior
@victorlin victorlin force-pushed the victorlin/simplify-hover-detection branch from b051baf to 4b6cee4 Compare June 5, 2024 23:31
@victorlin victorlin temporarily deployed to nextstrain-s-victorlin--kg9kva June 5, 2024 23:31 Inactive
Comment on lines 46 to 53

&:not(:hover)::before {
content: "${(props) => props.$content}";
}

&:hover::before {
content: "${(props) => props.$hoverContent || props.$content}";
}
Copy link
Member

Choose a reason for hiding this comment

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

non-blocking

This isn't what I meant… but that's on me for not specifying it and assuming you'd understand. I meant to include the content in the HTML itself (rather than using pseudo-elements in CSS) and only show the last label/name until hovered.

Don't worry about doing anything different now. I wanted to point out that I think there's a simplification here that's not mixing runtime inspection of CSS states with React component rendering.

Copy link
Member Author

@victorlin victorlin Jun 6, 2024

Choose a reason for hiding this comment

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

Oh gotcha, thanks for clarifying. I'll just drop bfbf4da and merge this PR. Maybe will try out that idea later...

@victorlin victorlin force-pushed the victorlin/simplify-hover-detection branch from bfbf4da to 4b6cee4 Compare June 6, 2024 00:11
@victorlin victorlin temporarily deployed to nextstrain-s-victorlin--kg9kva June 6, 2024 00:11 Inactive
@victorlin victorlin merged commit 5f75819 into master Jun 6, 2024
10 checks passed
@victorlin victorlin deleted the victorlin/simplify-hover-detection branch June 6, 2024 00:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants