Skip to content

Commit 5797aa4

Browse files
committed
feat(@clayui/language-picker): LPD-45714 Does not use ClayButton to avoid the btn class and update the styles
1 parent 6c6f952 commit 5797aa4

File tree

3 files changed

+18
-49
lines changed

3 files changed

+18
-49
lines changed

packages/clay-language-picker/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
"react"
2525
],
2626
"dependencies": {
27-
"@clayui/button": "^3.116.0",
2827
"@clayui/core": "^3.124.0",
2928
"@clayui/icon": "^3.111.0",
3029
"@clayui/label": "^3.111.0",

packages/clay-language-picker/src/__tests__/__snapshots__/index.tsx.snap

+13-37
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ exports[`ClayLanguagePicker renders 1`] = `
77
aria-expanded="false"
88
aria-haspopup="listbox"
99
aria-label="Select a language, current language: English (United States)."
10-
class="form-control-select btn btn-secondary"
10+
class="form-control form-control-select form-control-select-secondary"
1111
role="combobox"
1212
tabindex="0"
1313
type="button"
@@ -24,11 +24,7 @@ exports[`ClayLanguagePicker renders 1`] = `
2424
/>
2525
</svg>
2626
</span>
27-
<span
28-
class="font-weight-normal mr-2"
29-
>
30-
en-US
31-
</span>
27+
en-US
3228
</button>
3329
</div>
3430
`;
@@ -40,7 +36,7 @@ exports[`ClayLanguagePicker renders a class name for the trigger 1`] = `
4036
aria-expanded="false"
4137
aria-haspopup="listbox"
4238
aria-label="Select a language, current language: English (United States)."
43-
class="trigger-class form-control-select btn btn-secondary"
39+
class="trigger-class form-control form-control-select form-control-select-secondary"
4440
role="combobox"
4541
tabindex="0"
4642
type="button"
@@ -57,11 +53,7 @@ exports[`ClayLanguagePicker renders a class name for the trigger 1`] = `
5753
/>
5854
</svg>
5955
</span>
60-
<span
61-
class="font-weight-normal mr-2"
62-
>
63-
en-US
64-
</span>
56+
en-US
6557
</button>
6658
</div>
6759
`;
@@ -73,7 +65,7 @@ exports[`ClayLanguagePicker renders a small picker 1`] = `
7365
aria-expanded="false"
7466
aria-haspopup="listbox"
7567
aria-label="Select a language, current language: English (United States)."
76-
class="form-control-select btn btn-sm btn-secondary"
68+
class="form-control form-control-select form-control-select-secondary form-control-sm"
7769
role="combobox"
7870
tabindex="0"
7971
type="button"
@@ -90,11 +82,7 @@ exports[`ClayLanguagePicker renders a small picker 1`] = `
9082
/>
9183
</svg>
9284
</span>
93-
<span
94-
class="font-weight-normal mr-2"
95-
>
96-
en-US
97-
</span>
85+
en-US
9886
</button>
9987
</div>
10088
`;
@@ -106,7 +94,7 @@ exports[`ClayLanguagePicker renders hidding the trigger text 1`] = `
10694
aria-expanded="false"
10795
aria-haspopup="listbox"
10896
aria-label="Select a language, current language: English (United States)."
109-
class="form-control-select hidden-label btn btn-secondary"
97+
class="form-control form-control-select form-control-select-secondary hidden-label"
11098
role="combobox"
11199
tabindex="0"
112100
type="button"
@@ -134,7 +122,7 @@ exports[`ClayLanguagePicker renders the picker with id 1`] = `
134122
aria-expanded="false"
135123
aria-haspopup="listbox"
136124
aria-label="Select a language, current language: English (United States)."
137-
class="form-control-select btn btn-secondary"
125+
class="form-control form-control-select form-control-select-secondary"
138126
id="pickerId"
139127
role="combobox"
140128
tabindex="0"
@@ -152,11 +140,7 @@ exports[`ClayLanguagePicker renders the picker with id 1`] = `
152140
/>
153141
</svg>
154142
</span>
155-
<span
156-
class="font-weight-normal mr-2"
157-
>
158-
en-US
159-
</span>
143+
en-US
160144
</button>
161145
</div>
162146
`;
@@ -168,7 +152,7 @@ exports[`ClayLanguagePicker renders with custom labels 1`] = `
168152
aria-expanded="false"
169153
aria-haspopup="listbox"
170154
aria-label="Trigger Label"
171-
class="form-control-select btn btn-secondary"
155+
class="form-control form-control-select form-control-select-secondary"
172156
role="combobox"
173157
tabindex="0"
174158
type="button"
@@ -185,11 +169,7 @@ exports[`ClayLanguagePicker renders with custom labels 1`] = `
185169
/>
186170
</svg>
187171
</span>
188-
<span
189-
class="font-weight-normal mr-2"
190-
>
191-
en-US
192-
</span>
172+
en-US
193173
</button>
194174
</div>
195175
`;
@@ -201,7 +181,7 @@ exports[`ClayLanguagePicker renders with translations 1`] = `
201181
aria-expanded="false"
202182
aria-haspopup="listbox"
203183
aria-label="Select a language, current language: English (United States)."
204-
class="form-control-select btn btn-secondary"
184+
class="form-control form-control-select form-control-select-secondary"
205185
role="combobox"
206186
tabindex="0"
207187
type="button"
@@ -218,11 +198,7 @@ exports[`ClayLanguagePicker renders with translations 1`] = `
218198
/>
219199
</svg>
220200
</span>
221-
<span
222-
class="font-weight-normal mr-2"
223-
>
224-
en-US
225-
</span>
201+
en-US
226202
</button>
227203
</div>
228204
`;

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

+5-11
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
* SPDX-License-Identifier: BSD-3-Clause
44
*/
55

6-
import ClayButton from '@clayui/button';
76
import {Option, Picker} from '@clayui/core';
87
import ClayIcon from '@clayui/icon';
98
import ClayLabel from '@clayui/label';
@@ -167,19 +166,18 @@ const Trigger = React.forwardRef<HTMLButtonElement>(
167166
ref
168167
) => {
169168
return (
170-
<ClayButton
169+
<button
171170
{...otherProps}
172171
aria-label={ariaLabelTrigger}
173172
className={classNames(
174173
classNamesTrigger,
175-
'form-control-select',
174+
'form-control form-control-select form-control-select-secondary',
176175
{
176+
'form-control-sm': small,
177177
'hidden-label': hideTriggerText,
178178
}
179179
)}
180-
displayType="secondary"
181180
ref={ref}
182-
size={small ? 'sm' : undefined}
183181
>
184182
<span className="inline-item-before">
185183
<ClayIcon
@@ -188,12 +186,8 @@ const Trigger = React.forwardRef<HTMLButtonElement>(
188186
/>
189187
</span>
190188

191-
{!hideTriggerText ? (
192-
<span className="font-weight-normal mr-2">
193-
{selectedLocale.label}
194-
</span>
195-
) : null}
196-
</ClayButton>
189+
{!hideTriggerText ? selectedLocale.label : null}
190+
</button>
197191
);
198192
}
199193
);

0 commit comments

Comments
 (0)