Skip to content

Commit 35025a8

Browse files
committed
feat(@clayui/language-picker): LPD-45714 Replace displayName by name
1 parent effc1b6 commit 35025a8

File tree

3 files changed

+12
-13
lines changed

3 files changed

+12
-13
lines changed

packages/clay-core/src/language-picker/__tests__/index.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,27 @@ import React from 'react';
1515

1616
const locales = [
1717
{
18-
displayName: 'English (United States)',
1918
id: 'en_US',
2019
label: 'en-US',
20+
name: 'English (United States)',
2121
symbol: 'en-us',
2222
},
2323
{
24-
displayName: 'Spanish (Spain)',
2524
id: 'es_ES',
2625
label: 'es-ES',
26+
name: 'Spanish (Spain)',
2727
symbol: 'es-es',
2828
},
2929
{
30-
displayName: 'French (France)',
3130
id: 'fr_FR',
3231
label: 'fr-FR',
32+
name: 'French (France)',
3333
symbol: 'fr-fr',
3434
},
3535
{
36-
displayName: 'Dutch (Netherlands)',
3736
id: 'nl_NL',
3837
label: 'nl-NL',
38+
name: 'Dutch (Netherlands)',
3939
symbol: 'nl-nl',
4040
},
4141
];

packages/clay-core/src/language-picker/index.tsx

+4-5
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ import {Option, Picker} from '../picker';
1515
type DisplayType = 'info' | 'secondary' | 'success' | 'warning';
1616

1717
type Item = {
18-
displayName?: string;
1918
id: string;
2019
label: string;
20+
name?: string;
2121
symbol: string;
2222
};
2323

@@ -171,7 +171,7 @@ const Trigger = React.forwardRef<HTMLButtonElement>(
171171
<button
172172
{...otherProps}
173173
aria-label={sub(triggerMessage, [
174-
selectedItem?.displayName || selectedItem?.label,
174+
selectedItem?.name || selectedItem?.label,
175175
])}
176176
className={classNames(
177177
classNamesTrigger,
@@ -255,7 +255,7 @@ const ClayLanguagePicker = ({
255255
return (
256256
<Option
257257
aria-label={sub(messages.option, [
258-
locale.displayName || locale.label,
258+
locale.name || locale.label,
259259
translationLabel.label,
260260
])}
261261
key={locale.id}
@@ -292,8 +292,7 @@ const ClayLanguagePicker = ({
292292

293293
<span className="sr-only">
294294
{sub(messages.option, [
295-
locale.displayName ||
296-
locale.label,
295+
locale.name || locale.label,
297296
translationLabel.label,
298297
])}
299298
</span>

packages/clay-core/stories/LanguagePicker.stories.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,27 @@ export default {
1414

1515
const locales = [
1616
{
17-
displayName: 'English (United States)',
1817
id: 'en_US',
1918
label: 'en-US',
19+
name: 'English (United States)',
2020
symbol: 'en-us',
2121
},
2222
{
23-
displayName: 'Arabic (Saudi Arabia)',
2423
id: 'ar_SA',
2524
label: 'ar-SA',
25+
name: 'Arabic (Saudi Arabia)',
2626
symbol: 'ar-sa',
2727
},
2828
{
29-
displayName: 'Catalan (Spain)',
3029
id: 'ca_ES',
3130
label: 'ca-ES',
31+
name: 'Catalan (Spain)',
3232
symbol: 'ca-es',
3333
},
3434
{
35-
displayName: 'Dutch (Netherlands)',
3635
id: 'nl_NL',
3736
label: 'nl-NL',
37+
name: 'Dutch (Netherlands)',
3838
symbol: 'nl-nl',
3939
},
4040
];

0 commit comments

Comments
 (0)