introducing countrySelect component
This commit is contained in:
parent
1caa082f45
commit
0d7b760f91
13
src/assets/css/components/CountrySelect.scss
Normal file
13
src/assets/css/components/CountrySelect.scss
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
.country-select {
|
||||||
|
@apply bg-white border border-neutral-300 border-solid max-h-64 overflow-y-auto rounded-lg shadow-lg text-white w-fit;
|
||||||
|
&__country-list {
|
||||||
|
overflow-y: scroll;
|
||||||
|
@apply list-none;
|
||||||
|
}
|
||||||
|
li {
|
||||||
|
@apply flex items-center text-neutral-800 py-1;
|
||||||
|
.flag {
|
||||||
|
@apply pr-4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
28
src/components/CountrySelect.jsx
Normal file
28
src/components/CountrySelect.jsx
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
import React from "react";
|
||||||
|
import { COUNTRIES } from "../utils/countries.js";
|
||||||
|
import { v4 as uuidv4 } from "uuid";
|
||||||
|
|
||||||
|
export default function CountrySelect() {
|
||||||
|
const test = COUNTRIES.map((country) => {
|
||||||
|
if (!country.value) return;
|
||||||
|
return (
|
||||||
|
<li key={uuidv4()} value={country.value}>
|
||||||
|
<img
|
||||||
|
className='flag'
|
||||||
|
src={`https://flagsapi.com/${country.value}/flat/32.png`}
|
||||||
|
alt=''
|
||||||
|
/>
|
||||||
|
{country.title}
|
||||||
|
</li>
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!COUNTRIES) return;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className='country-select'>
|
||||||
|
<button className='country-select__toggle'>Salut</button>
|
||||||
|
<ul className='country-select__country-list'>{test}</ul>;
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user