diff --git a/country-explorer/src/components/App.css b/country-explorer/src/components/App.css index 8f26ef0..c1321cc 100644 --- a/country-explorer/src/components/App.css +++ b/country-explorer/src/components/App.css @@ -1,19 +1 @@ -.country-selection { - display: flex; - flex-wrap: wrap; - align-items: center; - justify-content: center; - gap: 0.5rem; - margin: 1rem; -} - -.country-selection select { - min-width: 0; - max-width: 100%; - padding: 0.5rem; - font: inherit; - color: var(--text-h); - background: var(--bg); - border: 1px solid var(--border); - border-radius: 4px; -} +/* Main layout styles go here. */ diff --git a/country-explorer/src/components/App.tsx b/country-explorer/src/components/App.tsx index a0b019f..8521f7e 100644 --- a/country-explorer/src/components/App.tsx +++ b/country-explorer/src/components/App.tsx @@ -2,6 +2,7 @@ import './App.css'; import { useState } from 'react'; import { useCountries } from '../hooks/useCountries'; import CountryCard from './CountryCard'; +import CountrySelector from './CountrySelector'; import Loading from './Loading'; import ErrorMessage from './ErrorMessage'; import NavigationControls from './NavigationControls'; @@ -40,22 +41,12 @@ function App() {

Filters and selection

{/* RegionFilter and SortSelector go here */} -
- - -
+
diff --git a/country-explorer/src/components/CountrySelector.css b/country-explorer/src/components/CountrySelector.css new file mode 100644 index 0000000..5bd5534 --- /dev/null +++ b/country-explorer/src/components/CountrySelector.css @@ -0,0 +1,24 @@ +.country-selection { + display: flex; + flex-wrap: wrap; + align-items: center; + justify-content: center; + gap: 0.5rem; + margin: 1rem; +} + +.country-selection select { + min-width: 0; + max-width: 100%; + padding: 0.5rem; + font: inherit; + color: var(--text-h); + background: var(--bg); + border: 1px solid var(--border); + border-radius: 4px; +} + +.country-selection select:focus-visible { + outline: 2px solid var(--accent); + outline-offset: 3px; +} diff --git a/country-explorer/src/components/CountrySelector.tsx b/country-explorer/src/components/CountrySelector.tsx new file mode 100644 index 0000000..3b24caf --- /dev/null +++ b/country-explorer/src/components/CountrySelector.tsx @@ -0,0 +1,46 @@ +import { useId } from 'react'; +import type { Country } from '../types/country'; +import './CountrySelector.css'; + +interface CountrySelectorProps { + countries: Country[]; + selectedCountryCode: string | null; + onSelectCountry: (code: string) => void; + disabled?: boolean; +} + +function CountrySelector({ + countries, + selectedCountryCode, + onSelectCountry, + disabled = false, +}: CountrySelectorProps) { + const selectId = useId(); + + return ( +
+ + +
+ ); +} + +export default CountrySelector;