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

refactor: make ContentSwitcher tabs design reusable #4066

Merged
merged 7 commits into from
Oct 22, 2024

Conversation

marcelgerber
Copy link
Member

@marcelgerber marcelgerber commented Oct 17, 2024

Part of #4015.

This makes it so the existing <Tabs> component now also handles <ContentSwitcher>, which is the component used for chart/map/table tabs.

I'm doing this by creating two styling variants for <Tabs>:

Upsides:

  • The chart switcher, when focussed, can now also react to arrow keys for tab switching
  • It is easy to create new components with this compact tab layout and full tab functionality

Downside:

  • The width-calculating code inside ContentSwitcher.tsx now relies on variables inside both ContentSwitcher.scss and Tabs.scss

There shouldn't be any visual differences before and after, these tabs should look precisely the same as they did before 🕵🏻

especially necessary for analytics tracking, so we can consistently recognize clicks inside the button padding
@owidbot
Copy link
Contributor

owidbot commented Oct 17, 2024

Quick links (staging server):

Site Admin Wizard

Login: ssh owid@staging-site-content-switcher-refactor

SVG tester:

Number of differences (default views): 0 ✅
Number of differences (all views): 0 ✅

Edited: 2024-10-17 15:54:17 UTC
Execution time: 1.18 seconds

Copy link
Member

@sophiamersmann sophiamersmann left a comment

Choose a reason for hiding this comment

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

Nice!

The "Show more" button in the sources tab should be styled a bit differently, otherwise looks good!

Example chart: http://staging-site-content-switcher-refactor/grapher/covid-vaccine-by-age

Prod Staging
Screenshot 2024-10-22 at 12 36 54 Screenshot 2024-10-22 at 12 36 58

@marcelgerber
Copy link
Member Author

Ah good catch, thank you!

@marcelgerber marcelgerber merged commit 9fe8632 into master Oct 22, 2024
12 of 14 checks passed
@marcelgerber marcelgerber deleted the content-switcher-refactor branch October 22, 2024 13:03
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.

3 participants