introducing countrySelect component

This commit is contained in:
Antoine M 2024-01-31 19:40:33 +01:00
parent 1caa082f45
commit 0d7b760f91
2 changed files with 41 additions and 0 deletions

View 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;
}
}
}

View 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>
);
}