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

Switch: New component contribution #825

Merged
merged 15 commits into from
Oct 31, 2024
Merged

Switch: New component contribution #825

merged 15 commits into from
Oct 31, 2024

Conversation

michael-iden
Copy link
Contributor

This change: (check at least one)

  • Adds a new feature
  • Fixes a bug
  • Improves maintainability
  • Improves documentation
  • Is a release activity

Is this a breaking change? (check one)

  • Yes
  • No

Is the: (complete all)

  • Title of this pull request clear, concise, and indicative of the issue number it addresses, if any?
  • Test suite(s) passing?
  • Code coverage maximal?
  • Changeset added?
  • Component status page up to date?

What does this change address?
Closes #821 by creating a new toggle switch component

How does this change work?
Adds a stylized variant of a checkbox to indicate an enabled/disabled state and a mechanisms to update the state

Additional context

@michael-iden michael-iden requested a review from a team as a code owner October 25, 2024 20:29
@michael-iden michael-iden requested review from sirrah-tam, jialin-he and mtorres3 and removed request for a team October 25, 2024 20:29
Copy link

changeset-bot bot commented Oct 25, 2024

🦋 Changeset detected

Latest commit: 19ebdfa

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@ithaka/pharos-site Minor
@ithaka/pharos Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Contributor

github-actions bot commented Oct 25, 2024

size-limit report 📦

Path Size
packages/pharos/lib/index.js 66.69 KB (+0.66% 🔺)

Comment on lines +11 to +12
height: 32px;
width: 70px;
Copy link
Member

Choose a reason for hiding this comment

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

Are these something that can/should be calculated from other values, or are they pretty squarely hand-crafted? Same question really for any hard-coded values, though some needing more scrutiny than others I'm sure.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

From the mockup they appear to rather handcrafted. Technically 32px is 2rem but that could be mostly coincidental? @fswlee anything here you suggest or worth adding context to?

Copy link

Choose a reason for hiding this comment

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

the little knob is 1rem x 1rem and there's .5rem space above ad below which creates the height. the width is a little more arbitrary. we could consider being more specific and intentional with our values, for sure. let me look at some options

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ahh i might have the knob 1px small in both dimensions right now at 15px. I can tweak as part of this too

packages/pharos/src/components/switch/pharos-switch.scss Outdated Show resolved Hide resolved
border-radius: 2rem;
background-color: var(--pharos-color-marble-gray-94);
transition:
background-color 0.3s ease-out,
Copy link
Contributor

@brentswisher brentswisher Oct 30, 2024

Choose a reason for hiding this comment

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

I do like the way this works, but see it is not one of our transition tokens. I wonder if switching to --pharos-transition-duration-default (which is 250 ms) so it matches our other transitions would be make a noticeable difference?(cc @fswlee as this is mostly a design decision)

Copy link
Member

Choose a reason for hiding this comment

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

FWIW 50ms is generally imperceptible to humans so I'd go for the token value too 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@brentswisher
Copy link
Contributor

🤔 Running pharos site locally, I am not seeing the component render in the examples. but I am seeing the label.

Screenshot 2024-10-30 at 8 33 40 AM

@brentswisher
Copy link
Contributor

brentswisher commented Oct 30, 2024

🤔 Running pharos site locally, I am not seeing the component render in the examples. but I am seeing the label.

Ah, never mind, the site just needs the new component added where it is initializing Pharos components, I can push a fix for that

Copy link
Contributor

@brentswisher brentswisher left a comment

Choose a reason for hiding this comment

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

Left one note about the transition length, but I'm good with whatever way that decision goes, it's looking really good!

Copy link
Contributor

@sirrah-tam sirrah-tam left a comment

Choose a reason for hiding this comment

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

This looks and tests great! Verified against VoiceOver + Safari/Chrome on MacOS and JAWS + Edge/Chrome & NVDA + Firefox on Windows.

@michael-iden michael-iden merged commit fc902f2 into develop Oct 31, 2024
11 checks passed
@michael-iden michael-iden deleted the feature/switch branch October 31, 2024 15:53
@github-actions github-actions bot mentioned this pull request Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Toggle switch
5 participants