Skip to content

Create LanguageDropDown component #5981

@bmuenzenmeyer

Description

@bmuenzenmeyer

Create a LanguageDropDown component using the new figma design (direct link).

This component is an icon-button that when activated shows a dropdown of all locales. This is the final port of the LanguageDropDowncomponent recently deleted. Much of the functionality is the same to end users, but with different tech.

Read more about the Node.js Website redesign


Before You Start...


Details

image
image

Not sure where to start breaking down the figma? Read this short guide
🌐 This story requires some internationalization support. Slow down!

  • Create a new directory called LanguageDropDown within the Common directory that contains all the new code.
  • Install @radix-ui/react-dropdown-menu for the accessible foundation and functionality we need.
    • Use DropdownMenu.Trigger to place the icon and button
    • The @heroicons/react module has the icon language available for use.
    • source the languages to display and the current value from the '@/hooks/useLocale' hook
    • implement a no-op for the click handler
  • Add a storybook story file components/Common/LanguageDropDown/index.stories.tsx which exercises each of the component's states.
  • Delete https://github.com/search?q=repo%3Anodejs%2Fnodejs.org%20useClickOutside&type=code after a quick search of the codebase - this was leftover from the previous design
  • The aria-label must be internationalized, and in English state Choose Language. Add a new key components.common.languageDropdown.label to the i18n/locales/en.json file. useIntl from react-intl should be used to reference the key. Look for examples elsewhere in the codebase or in the old PR.

There are 2 states to capture within styles and stories:

  • Light
  • Dark

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions