File tree Expand file tree Collapse file tree 7 files changed +61
-25
lines changed
documentation/docs/tutorial/03-Customization Expand file tree Collapse file tree 7 files changed +61
-25
lines changed Original file line number Diff line number Diff line change @@ -861,6 +861,22 @@ Spinner component is used to display a loading state for a component.
861861 </div >
862862</div >
863863
864+ ## Country Flag
865+
866+ The Country Flag component displays national flags using ISO 3166-1 alpha-2 country codes.
867+
868+ <div class =" split-screen " >
869+ <div >
870+ ``` html
871+ <CountryFlag countryCode =" ua" />
872+ ```
873+ </div >
874+ <div >
875+ ![ Country Flag] ( image-92.png )
876+ </div >
877+ </div >
878+
879+
864880## Bar Chart
865881
866882Under the hood AdminForth uses MIT-licensed [ ApexCharts] ( https://apexcharts.com/ ) . It has very rich variety of options, you can pass
@@ -1454,7 +1470,7 @@ import { PieChart } from '@/afcl'
14541470//diff-add
14551471 offset: -10, // Moves labels closer to or further from the slices
14561472//diff-add
1457- minAngleToShowLabel: 10, // Ensures that small slices don’ t show labels
1473+ minAngleToShowLabel: 10, // Ensures that small slices don' t show labels
14581474//diff-add
14591475 },
14601476//diff-add
@@ -1686,7 +1702,3 @@ import { MixedChart } from '@/afcl'
16861702 </div >
16871703</div >
16881704
1689-
1690-
1691-
1692-
Original file line number Diff line number Diff line change 1313 "i18n:extract" : " echo '{}' > i18n-empty.json && vue-i18n-extract report --vueFiles './src/**/*.?(js|vue)' --output ./i18n-messages.json --languageFiles 'i18n-empty.json' --add"
1414 },
1515 "dependencies" : {
16+ "@iconify-prerendered/vue-flag" : " ^0.28.1748584105" ,
1617 "@iconify-prerendered/vue-flowbite" : " ^0.23.1714023977" ,
1718 "@unhead/vue" : " ^1.9.12" ,
1819 "@vueuse/core" : " ^10.10.0" ,
Original file line number Diff line number Diff line change 1+ <template >
2+ <component v-if =" getFlagComponent(countryCode)" class =" flag-icon rounded-sm" :is =" getFlagComponent(countryCode)" />
3+ <span v-else-if =" countryCode" >{{ countryCode }}</span >
4+ </template >
5+
6+ <script setup lang="ts">
7+ import * as FlagIcons from ' @iconify-prerendered/vue-flag' ;
8+
9+ defineProps ([' countryCode' ]);
10+
11+ const getFlagComponent = (countryCode : string ) => {
12+ if (! countryCode ) return null ;
13+
14+ const normalizedCode = countryCode .charAt (0 ).toUpperCase () + countryCode .slice (1 ).toLowerCase ();
15+ const iconName = ` Icon${normalizedCode }4x3 ` ; // 4:3 aspect ratio flags
16+ return FlagIcons [iconName as keyof typeof FlagIcons ] || null ;
17+ };
18+ </script >
19+
20+ <style scoped>
21+ .flag-icon {
22+ box-shadow : inset -0.3px -0.3px 0.3px 0px rgba (0 0 0 / 0.2 ),
23+ inset 0.3px 0.3px 0.3px 0px rgba (255 255 255 / 0.2 ),
24+ 0px 0px 3px #00000030 ;
25+ }
26+ </style >
Original file line number Diff line number Diff line change @@ -18,5 +18,7 @@ export { default as Spinner } from './Spinner.vue';
1818export { default as Skeleton } from './Skeleton.vue' ;
1919export { default as Dialog } from './Dialog.vue' ;
2020export { default as MixedChart } from './MixedChart.vue' ;
21+ export { default as CountryFlag } from './CountryFlag.vue' ;
22+
2123
2224
Original file line number Diff line number Diff line change 11<template >
22 <Tooltip >
33 <span class =" flex items-center" >
4- <span
5- :class =" {[`fi-${countryIsoLow}`]: true, 'flag-icon': countryName}"
6- ></span >
4+ <CountryFlag class =" w-[1.6rem] h-[1.2rem]" :countryCode =" countryIsoLow" />
75 <span v-if =" meta.showCountryName" class =" ms-2" >{{ countryName }}</span >
86 </span >
97
1614<script setup>
1715
1816import { computed , ref , onMounted } from ' vue' ;
19- import ' flag-icons/css/flag-icons.min.css' ;
2017import isoCountries from ' i18n-iso-countries' ;
2118import enLocal from ' i18n-iso-countries/langs/en.json' ;
2219import Tooltip from ' @/afcl/Tooltip.vue' ;
20+ import CountryFlag from ' @/afcl/CountryFlag.vue' ;
2321
2422isoCountries .registerLocale (enLocal);
2523
@@ -47,19 +45,3 @@ const countryName = computed(() => {
4745});
4846
4947< / script>
50-
51- < style scoped lang= " scss" >
52-
53- .flag - icon {
54- width: 1 .6rem ;
55- height: 1 .2rem ;
56- flex- shrink: 0 ;
57-
58- // border radius for background
59- border- radius: 2px ;
60- box- shadow: inset - 0 .3px - 0 .3px 0 .3px 0px rgba (0 0 0 / 0.2 ),
61- inset 0 .3px 0 .3px 0 .3px 0px rgba (255 255 255 / 0.2 ),
62- 0px 0px 3px #00000030 ;
63- }
64-
65- < / style>
You can’t perform that action at this time.
0 commit comments