Skip to content

Commit 3e5ba15

Browse files
committed
fix: Remove country name from country picker
1 parent ef5e381 commit 3e5ba15

File tree

2 files changed

+28
-20
lines changed

2 files changed

+28
-20
lines changed

packages/firebaseui-react/src/components/country-selector.tsx

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,28 @@ export function CountrySelector({
1818
<div className={cn("fui-country-selector", className)}>
1919
<div className="fui-country-selector__wrapper">
2020
<span className="fui-country-selector__flag">{value.emoji}</span>
21-
<select
22-
value={value.code}
23-
onChange={(e) => {
24-
const country = countryData.find((c) => c.code === e.target.value);
25-
if (country) {
26-
onChange(country);
27-
}
28-
}}
29-
>
30-
{countryData.map((country) => (
31-
<option
32-
key={`${country.code}-${country.dialCode}`}
33-
value={country.code}
34-
>
35-
{country.dialCode} ({country.name})
36-
</option>
37-
))}
38-
</select>
21+
<div className="fui-country-selector__select-wrapper">
22+
<span className="fui-country-selector__dial-code">{value.dialCode}</span>
23+
<select
24+
className="fui-country-selector__select"
25+
value={value.code}
26+
onChange={(e) => {
27+
const country = countryData.find((c) => c.code === e.target.value);
28+
if (country) {
29+
onChange(country);
30+
}
31+
}}
32+
>
33+
{countryData.map((country) => (
34+
<option
35+
key={`${country.code}-${country.dialCode}`}
36+
value={country.code}
37+
>
38+
{country.dialCode} ({country.name})
39+
</option>
40+
))}
41+
</select>
42+
</div>
3943
</div>
4044
</div>
4145
);

packages/firebaseui-styles/src/base.css

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@
126126
}
127127

128128
.fui-country-selector {
129-
@apply relative inline-block min-w-[120px];
129+
@apply relative inline-block w-[80px];
130130
}
131131

132132
.fui-country-selector__wrapper {
@@ -138,6 +138,10 @@
138138
}
139139

140140
.fui-country-selector select {
141-
@apply w-full pl-8 pr-2 py-2 text-sm focus:outline-2 focus:outline-primary shadow-xs bg-transparent appearance-none cursor-pointer;
141+
@apply w-full pl-8 pr-2 py-2 text-sm focus:outline-2 focus:outline-primary shadow-xs bg-transparent appearance-none cursor-pointer text-transparent;
142+
}
143+
144+
.fui-country-selector__dial-code {
145+
@apply absolute left-8 top-1/2 -translate-y-1/2 text-sm pointer-events-none text-text;
142146
}
143147
}

0 commit comments

Comments
 (0)