@econnect/webcomponents-library
Documentation
Styleguide
Documentation
Styleguide
  • Getting Started

    • Installation
    • Patch Notes
    • Styleguide
  • Styling

    • e-connect colors
  • UI Components

    • Form

      • Search Field
      • Form Field
      • Forms
    • Filter

      • Filter
      • Search Filter
    • Grid

      • Grid
      • Grid Row
    • Inputs

      • File Input
      • Input Checkbox
      • Input Dropdown
      • Input Date
      • Input Date Time
      • Input Date Time Local
      • Input File
      • Input Label
      • Input Multi Select
      • Input Number
      • Input Radio
      • Input Range
      • Input Select
      • Input Switch
      • Input Slider
      • Input Text
      • Input TextArea
      • Input Time
      • Input Time Range
    • Controls

      • Booleans
      • Button
      • Checkboxes
      • Date Displays
      • Dropdown Lists
      • Text Displays
    • Headers

      • e-header
    • Cards

      • e-card
    • Images

      • Icon
      • Images
      • Flag Image
      • Hamburger
    • Iframe
    • Pager
    • Settings
    • Document Validation
    • Navigation

      • Navigation
      • Navigation Menu
      • Navigation Footer
      • Navigation Button
      • Navigation Button Item
      • Navigation Search Item

Flag Image v1.0

The <e-flag-image> component is a component that can be used for for displaying the country flag based by the iso code.

Usage

The e-flag-image has attributes that must be provided,

<e-flag-image
  :isoCode="nl"
  :cdnBaseUrl="cdnBaseUrl"
/>
sandbox data :
isoCode: nlcdnBaseUrl: https://accp-cdn.econnect.rocks/
flag_nl

Attributes

isoCode | Type: String | required
cdnBaseUrl | Type: String | required

<e-flag-image
  isoCode="nl"
  :cdnBaseUrl="cdnBaseUrl"
/>

Examples

Below a few interactive examples of e-images can be found.

NL Flag
<e-flag-image
  :isoCode="nl"
  :cdnBaseUrl="https://accp-cdn.econnect.rocks/"
/>
flag_nl
PL Flag
<e-flag-image
  :isoCode="pl"
  :cdnBaseUrl="https://accp-cdn.econnect.rocks/"
/>
flag_pl

Source Code

e-flag-image.vue
<script setup lang="ts">
import { computed } from 'vue';

import { Locale } from 'types/locale';

export type Props = {
  isoCode?: Locale | 'unknown' | string;
  cdnBaseUrl: string;
};

const props = withDefaults(defineProps<Props>(), {
  isoCode: 'unknown'
});

const isoCodeImage = computed(() => {
  return `${props.cdnBaseUrl}media/flags/${props.isoCode}.svg`;
});
</script>

<template>
  <div class="e-flag-image">
    <img
      :src="isoCodeImage"
      :alt="`flag_${isoCode}`"
    />
  </div>
</template>

<style scoped lang="scss">
.e-flag-image {
  width: 24px;

  img {
    max-width: 24px;
    max-height: 24px;
    border-radius: 6px;
  }
}
</style>
Last Updated:: 10/10/24, 2:56 PM
Contributors: Justin Berghahn, Marcel Lommers
Prev
Images
Next
Hamburger