Skip to content

Replace SVG icons for country flags with Flag CDN URLs #78

Description

@chibie

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

  1. 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.

  2. 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.

  3. 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

  1. 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,
      },
    ];
  2. 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.
  3. Test the implementation across all supported currencies to ensure flags load correctly.

Notes/Assumptions

  1. The flagcdn.com service is reliable and provides high-quality, up-to-date flags.
  2. The country code mapping for currencies is accurate and consistent.
  3. The fallback mechanism for missing or invalid flags should be implemented to avoid broken images.
  4. 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?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions