User Story
As a user, I want to see accurate and up-to-date country flags for currencies, so that the UI feels more modern and consistent.
Acceptance Criteria
-
GIVEN a user views the currency selection dropdown
WHEN the dropdown is loaded
THEN the country flags should be displayed using https://flagcdn.com/w40/<countryCode>.png.
-
GIVEN a currency is selected
WHEN the currency is displayed elsewhere in the UI
THEN the corresponding country flag from flagcdn.com should be shown.
-
GIVEN a currency does not have a valid country code mapping
WHEN the UI attempts to load the flag
THEN a fallback icon or placeholder should be displayed.
Tech Details
- Update the
currencies array in apps/mocks.ts to use flagcdn.com URLs instead of local SVG/PNG files.
export const currencies = [
{
name: "KES",
label: "Kenyan Shilling (KES)",
imageUrl: "https://flagcdn.com/w40/ke.png",
},
{
name: "NGN",
label: "Nigerian Naira (NGN)",
imageUrl: "https://flagcdn.com/w40/ng.png",
},
{
name: "GHS",
label: "Ghanaian Cedi (GHS)",
imageUrl: "https://flagcdn.com/w40/gh.png",
disabled: true,
},
{
name: "BRL",
label: "Brazilian Real (BRL)",
imageUrl: "https://flagcdn.com/w40/br.png",
disabled: true,
},
{
name: "ARS",
label: "Argentine Peso (ARS)",
imageUrl: "https://flagcdn.com/w40/ar.png",
disabled: true,
},
];
- Add a mapping of currency codes to country codes (e.g.,
KES → ke, NGN → ng) to handle cases where the currency code does not directly match the country code.
- Test the implementation across all supported currencies to ensure flags load correctly.
Notes/Assumptions
- The
flagcdn.com service is reliable and provides high-quality, up-to-date flags.
- The country code mapping for currencies is accurate and consistent.
- The fallback mechanism for missing or invalid flags should be implemented to avoid broken images.
- Cloudflare caches the flag images locally to reduce dependency on
flagcdn.com
Open Questions
2. Are there any accessibility considerations for using flag images (e.g., alt text for screen readers)?
3. Should we support higher-resolution flags for high-DPI displays?
User Story
As a user, I want to see accurate and up-to-date country flags for currencies, so that the UI feels more modern and consistent.
Acceptance Criteria
GIVEN a user views the currency selection dropdown
WHEN the dropdown is loaded
THEN the country flags should be displayed using
https://flagcdn.com/w40/<countryCode>.png.GIVEN a currency is selected
WHEN the currency is displayed elsewhere in the UI
THEN the corresponding country flag from
flagcdn.comshould be shown.GIVEN a currency does not have a valid country code mapping
WHEN the UI attempts to load the flag
THEN a fallback icon or placeholder should be displayed.
Tech Details
currenciesarray inapps/mocks.tsto useflagcdn.comURLs instead of local SVG/PNG files.KES → ke,NGN → ng) to handle cases where the currency code does not directly match the country code.Notes/Assumptions
flagcdn.comservice is reliable and provides high-quality, up-to-date flags.flagcdn.comOpen Questions
2. Are there any accessibility considerations for using flag images (e.g., alt text for screen readers)?
3. Should we support higher-resolution flags for high-DPI displays?