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.
861
861
</div >
862
862
</div >
863
863
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
+
864
880
## Bar Chart
865
881
866
882
Under 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'
1454
1470
//diff-add
1455
1471
offset: -10, // Moves labels closer to or further from the slices
1456
1472
//diff-add
1457
- minAngleToShowLabel: 10, // Ensures that small slices don’ t show labels
1473
+ minAngleToShowLabel: 10, // Ensures that small slices don' t show labels
1458
1474
//diff-add
1459
1475
},
1460
1476
//diff-add
@@ -1686,7 +1702,3 @@ import { MixedChart } from '@/afcl'
1686
1702
</div >
1687
1703
</div >
1688
1704
1689
-
1690
-
1691
-
1692
-
Original file line number Diff line number Diff line change 13
13
"i18n:extract" : " echo '{}' > i18n-empty.json && vue-i18n-extract report --vueFiles './src/**/*.?(js|vue)' --output ./i18n-messages.json --languageFiles 'i18n-empty.json' --add"
14
14
},
15
15
"dependencies" : {
16
+ "@iconify-prerendered/vue-flag" : " ^0.28.1748584105" ,
16
17
"@iconify-prerendered/vue-flowbite" : " ^0.23.1714023977" ,
17
18
"@unhead/vue" : " ^1.9.12" ,
18
19
"@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';
18
18
export { default as Skeleton } from './Skeleton.vue' ;
19
19
export { default as Dialog } from './Dialog.vue' ;
20
20
export { default as MixedChart } from './MixedChart.vue' ;
21
+ export { default as CountryFlag } from './CountryFlag.vue' ;
22
+
21
23
22
24
Original file line number Diff line number Diff line change 1
1
<template >
2
2
<Tooltip >
3
3
<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" />
7
5
<span v-if =" meta.showCountryName" class =" ms-2" >{{ countryName }}</span >
8
6
</span >
9
7
16
14
<script setup>
17
15
18
16
import { computed , ref , onMounted } from ' vue' ;
19
- import ' flag-icons/css/flag-icons.min.css' ;
20
17
import isoCountries from ' i18n-iso-countries' ;
21
18
import enLocal from ' i18n-iso-countries/langs/en.json' ;
22
19
import Tooltip from ' @/afcl/Tooltip.vue' ;
20
+ import CountryFlag from ' @/afcl/CountryFlag.vue' ;
23
21
24
22
isoCountries .registerLocale (enLocal);
25
23
@@ -47,19 +45,3 @@ const countryName = computed(() => {
47
45
});
48
46
49
47
< / 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