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

va-language-toggle: add component #1386

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open

Conversation

it-harrison
Copy link
Contributor

@it-harrison it-harrison commented Nov 1, 2024

Chromatic

https://va-language-toggle--65a6e2ed2314f7b8f98609d8.chromatic.com


Description

This PR adds the va-language-toggle web component to the VA Design System component library. Note: the component has no analytics yet; it will be added pending discussion with the Analytics team.

Closes 2583

QA Checklist

  • Component maintains 1:1 parity with design mocks
  • Text is consistent with what's been provided in the mocks
  • Component behaves as expected across breakpoints
  • Accessibility expert has signed off on code changes (if applicable. If not applicable provide reason why)
  • Designer has signed off on changes (if applicable. If not applicable provide reason why)
  • Tab order and focus state work as expected
  • Changes have been tested against screen readers (if applicable. If not applicable provide reason why)
  • New components are covered by e2e tests; updates to existing components are covered by existing test suite
  • Changes have been tested in vets-website using Verdaccio (if applicable. If not applicable provide reason why)

Screenshots

Screenshot 2024-11-07 at 7 54 40 AM

Acceptance criteria

  • QA checklist has been completed
  • Screenshots have been attached that cover desktop and mobile screens

Definition of done

  • Documentation has been updated, if applicable
  • A link has been provided to the originating GitHub issue (or connected to it via ZenHub)

@it-harrison it-harrison added the major Major change in semantic versioning label Nov 1, 2024
@it-harrison it-harrison changed the title add component va-language-toggle: add component Nov 5, 2024
@it-harrison it-harrison marked this pull request as ready for review November 5, 2024 16:42
@it-harrison it-harrison requested a review from a team as a code owner November 5, 2024 16:42
Copy link
Contributor

@powellkerry powellkerry left a comment

Choose a reason for hiding this comment

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

LGTM

@jamigibbs jamigibbs added minor For a minor Semantic Version change and removed major Major change in semantic versioning labels Nov 5, 2024
/**
* A JSON array of objects with link data. Each object should have an href, lang (ISO language code), and label properties. If using the pure web component provide as a string. Example: `[{"href": "/one", "lang": "en", "label": "English"}, ...]`.
*/
@Prop() urls: LangUrl[] | string;
Copy link
Contributor

@jamigibbs jamigibbs Nov 5, 2024

Choose a reason for hiding this comment

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

I don't know if we want to add this type of flexibility. Our guidelines say that we only support 3 languages; English, Espanol, Tagalog

Other language options. VA.gov supports the 3 languages identified in the toggle. Do not add or remove from those 3 languages.

https://design.va.gov/components/language-toggle#usage

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jamigibbs - good point - I updated the component to only allow en, es, or tl.

@jamigibbs jamigibbs requested a review from a team November 6, 2024 14:35
componentName: 'va-language-toggle',
action: 'linkClick',
details: {
'pipe-delimited-list-header': langCode
Copy link
Contributor

@jamigibbs jamigibbs Nov 6, 2024

Choose a reason for hiding this comment

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

Were you able to connect with the analytics team about this addition? Is there a ticket or Slack convo we can link to here for context?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jamigibbs I met with them yesterday - they asked to be looped into this PR so they could take a look at the datalayer, which I have done

&.is-current-lang {
font-weight: var(--font-weight-bold);
text-decoration: none;
color: var(--vads-color-base);
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we have a Figma link that can be added to description of the PR? I think it would be worthwhile to get a review from one of the designers as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jamigibbs I'm reaching out to Barb on this

const defaultArgs = {
enHref: url.href,
esHref: url.href,
tlHref: url.href,
Copy link
Contributor

Choose a reason for hiding this comment

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

Any idea why these props are showing up on the Storybook page like this? I don't think other pages do that.

Screenshot 2024-11-06 at 8 37 19 AM

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jamigibbs - fixed!

Copy link
Contributor

@jamigibbs jamigibbs Nov 7, 2024

Choose a reason for hiding this comment

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

@it-harrison Awesome! Thanks for figuring that out! I think the only other thing that needs to be done is passing in an empty arguments object to the Template function so that the code examples populate:

Screenshot 2024-11-07 at 8 42 32 AM

Maybe something like this here on this line and this line too? I can't exactly remember what has fixed this in the past.

const Template = ({}) => {
 ...
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jamigibbs - good catch, fixed!

@it-harrison
Copy link
Contributor Author

it-harrison commented Nov 6, 2024

@babsdenney @danbrady @LWWright7 can you take a look to see if this matches design? in particular, I'm wondering about focus and hover states. Thanks!

@babsdenney
Copy link

@it-harrison We were able to take a look at the language toggle and were wondering if it would be possible to use the link component for the links and override the underline in this case? We were thinking this might be a better route so that if there are any changes to link styles in the future they would be pushed to this component vs. having to manually change the styles in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor For a minor Semantic Version change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build Language toggle web component - Development
4 participants