2023-09-17 18:49:37 +02:00
|
|
|
<template>
|
|
|
|
<SvgIcon
|
|
|
|
:type="type"
|
|
|
|
:path="iconPath"
|
|
|
|
:size="size"
|
|
|
|
:rotate="rotate"
|
2023-09-18 08:56:26 +02:00
|
|
|
:class="iconFlip"
|
2023-09-17 18:49:37 +02:00
|
|
|
/>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
import SvgIcon from '@jamescoyle/vue-icon';
|
|
|
|
import * as Icons from '@mdi/js';
|
|
|
|
import { computed, PropType } from 'vue';
|
|
|
|
|
|
|
|
const props = defineProps({
|
|
|
|
iconName: {
|
|
|
|
type: String,
|
|
|
|
required: true
|
|
|
|
},
|
|
|
|
size: {
|
|
|
|
type: Number,
|
|
|
|
default: 48
|
|
|
|
},
|
|
|
|
type: {
|
|
|
|
type: String,
|
|
|
|
default: () => 'mdi'
|
|
|
|
},
|
|
|
|
flip: {
|
|
|
|
type: String as PropType<'horizontal' | 'vertical' | 'both'>,
|
|
|
|
default: () => null
|
|
|
|
},
|
|
|
|
rotate: {
|
2023-09-17 19:04:24 +02:00
|
|
|
type: Number,
|
2023-09-17 18:49:37 +02:00
|
|
|
default: () => null
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
const iconPath = computed(() => {
|
|
|
|
return (Icons as {[k:string]: string})[props.iconName];
|
|
|
|
});
|
2023-09-18 08:56:26 +02:00
|
|
|
|
|
|
|
const iconFlip = computed(() => {
|
|
|
|
if (['horizontal', 'vertical', 'both'].includes(props.flip))
|
|
|
|
return `flip-${props.flip}`;
|
|
|
|
else return '';
|
|
|
|
});
|
2023-09-17 18:49:37 +02:00
|
|
|
</script>
|
2023-09-18 08:56:26 +02:00
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.flip-horizontal {
|
|
|
|
transform: scaleX(-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
.flip-vertical {
|
|
|
|
transform: scaleY(-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
.flip-both {
|
|
|
|
transform: scale(-1, -1);
|
|
|
|
}
|
|
|
|
</style>
|