Skip to content
This repository was archived by the owner on Jan 22, 2026. It is now read-only.

update toggle component to work with app dashboard#112

Merged
modernserf merged 3 commits intomasterfrom
modernserf/ch16429/update-toggle-shared-component-for-app-dashboard
Jun 2, 2020
Merged

update toggle component to work with app dashboard#112
modernserf merged 3 commits intomasterfrom
modernserf/ch16429/update-toggle-shared-component-for-app-dashboard

Conversation

@modernserf
Copy link
Copy Markdown
Contributor

https://app.clubhouse.io/glitch/story/16429/update-toggle-shared-component-for-app-dashboard-usage

  • add disabled state
  • make labels configurable (and blank by default)
  • document how to override colors

@modernserf modernserf requested a review from sheridanvk May 27, 2020 20:57
@Osmose Osmose requested review from Osmose and removed request for sheridanvk June 1, 2020 17:48
Copy link
Copy Markdown
Contributor

@Osmose Osmose left a comment

Choose a reason for hiding this comment

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

Looks good, nice work! A few comments, but nothing blocking.

One lingering question: Is defaulting to blank instead of the original text okay? It'd remove the text from any toggles we're using once they upgrade, but you know more about the toggles on dotcom and whether they should have text or not than I do.

height: var(--space-3);
width: var(--space-5);
font-weight: bold;
font-weight: 600;
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.

bold maps to 700, not sure if that matters here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yeah, this is supposed to be semi-bold

lib/toggle.js Outdated
`;

const Shuttle = (props) => (
const nbsp = ' ';
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.

Maybe blank instead since this isn't a true &nbsp?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

oh hm that was supposed to be a real nbsp, i'll fix that

};
Toggle.defaultProps = {
disabled: false,
trueLabel: '',
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.

Should we have something default here?

Other lgtm

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think it makes sense for the default labels to be blank (as they are on iOS), but we can add labels if we want them

Copy link
Copy Markdown
Contributor

@sheridanvk sheridanvk left a comment

Choose a reason for hiding this comment

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

looks good, just one suggestion added!

lib/toggle.js Outdated
Toggle.propTypes = {
value: PropTypes.any.isRequired,
onChange: PropTypes.func.isRequired,
label: PropTypes.string.isRequired,
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.

all these label names are a bit confusing now. I think this label is only used by aria-label now, right - shall we just call the parameter by the same name to make it clear (or input-aria-label)?

It is also a bit odd for the example that's provided in the story, because it separately has a "Notifications Settings" label, so I think we should really be passing in aria-labelledby for that example, with the ID of that label (per https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-label_attribute). We could leave that for a future PR though; perhaps a general accessibility sweep is needed.

@modernserf modernserf requested a review from sheridanvk June 2, 2020 12:25
Copy link
Copy Markdown
Contributor

@sheridanvk sheridanvk left a comment

Choose a reason for hiding this comment

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

this is great, thanks for the tweak!

@modernserf modernserf merged commit b0ef59c into master Jun 2, 2020
@modernserf modernserf deleted the modernserf/ch16429/update-toggle-shared-component-for-app-dashboard branch June 2, 2020 15:27
@keithk
Copy link
Copy Markdown
Contributor

keithk commented Nov 10, 2020

🚀 PR was released in v0.19.0 🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants