Skip to content

Commit

Permalink
feat: use localName in dropdown (#7337)
Browse files Browse the repository at this point in the history
  • Loading branch information
bmuenzenmeyer authored Dec 20, 2024
1 parent 53ce0b3 commit d3584a1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ type Meta = MetaObj<typeof LanguageDropDown>;
export const Default: Story = {
args: {
availableLanguages: [
{ name: 'English', code: 'en' },
{ name: 'French', code: 'fr' },
{ name: 'Spanish', code: 'es' },
{ name: 'English', code: 'en', localName: 'English' },
{ name: 'French', code: 'fr', localName: 'Français' },
{ name: 'Spanish', code: 'es', localName: 'Español' },
],
currentLanguage: 'en',
},
Expand Down
8 changes: 4 additions & 4 deletions apps/site/components/Common/LanguageDropDown/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type { FC } from 'react';

import styles from './index.module.css';

type SimpleLocaleConfig = Pick<LocaleConfig, 'name' | 'code'>;
type SimpleLocaleConfig = Pick<LocaleConfig, 'name' | 'code' | 'localName'>;

type LanguageDropDownProps = {
onChange?: (newLocale: SimpleLocaleConfig) => void;
Expand Down Expand Up @@ -39,15 +39,15 @@ const LanguageDropdown: FC<LanguageDropDownProps> = ({
sideOffset={5}
>
<div>
{availableLanguages.map(({ name, code }) => (
{availableLanguages.map(({ name, code, localName }) => (
<DropdownMenu.Item
key={code}
onClick={() => onChange({ name, code })}
onClick={() => onChange({ name, code, localName })}
className={classNames(styles.dropDownItem, {
[styles.currentDropDown]: code === currentLanguage,
})}
>
{name}
{localName}
</DropdownMenu.Item>
))}
</div>
Expand Down
6 changes: 3 additions & 3 deletions apps/site/components/Containers/NavBar/index.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ export const Default: Story = {
],
languages: {
availableLanguages: [
{ name: 'English', code: 'en' },
{ name: 'French', code: 'fr' },
{ name: 'Spanish', code: 'es' },
{ name: 'English', code: 'en', localName: 'English' },
{ name: 'French', code: 'fr', localName: 'Français' },
{ name: 'Spanish', code: 'es', localName: 'Español' },
],
currentLanguage: 'en',
},
Expand Down

0 comments on commit d3584a1

Please sign in to comment.