CommonIcon.story.vue 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <!-- Copyright (C) 2012-2023 Zammad Foundation, https://zammad-foundation.org/ -->
  2. <script setup lang="ts">
  3. import 'virtual:svg-icons-register' // eslint-disable-line import/no-unresolved
  4. import icons from 'virtual:svg-icons-names' // eslint-disable-line import/no-unresolved
  5. import { type Ref, ref, computed } from 'vue'
  6. import CommonIcon from './CommonIcon.vue'
  7. import type { Animations, Sizes } from './types'
  8. const iconNames = computed(() =>
  9. icons.map((icon) => icon.slice('icon-'.length)),
  10. )
  11. const size: Ref<Sizes | undefined> = ref()
  12. const sizes = ['xs', 'tiny', 'small', 'base', 'medium', 'large']
  13. const fixedSize: Ref<{ width: number; height: number } | undefined> = ref()
  14. const label = ref()
  15. const decorative = ref()
  16. const animation: Ref<Animations | undefined> = ref()
  17. const animations = ['pulse', 'spin', 'ping', 'bounce']
  18. </script>
  19. <template>
  20. <Story
  21. title="Icons"
  22. icon="uil:image"
  23. group="design-system"
  24. :layout="{ type: 'grid', width: '100px' }"
  25. >
  26. <template #controls>
  27. <HstSelect v-model="size" :options="sizes" title="Size" />
  28. <HstJson v-model="fixedSize" title="Fixed Size" />
  29. <HstText v-model="label" title="Label" />
  30. <HstCheckbox v-model="decorative" title="Decorative" />
  31. <HstSelect v-model="animation" :options="animations" title="Animation" />
  32. </template>
  33. <Variant
  34. v-for="iconName of iconNames"
  35. :id="iconName"
  36. :key="iconName"
  37. :title="iconName"
  38. icon="uil:icons"
  39. auto-props-disabled
  40. >
  41. <CommonIcon
  42. :size="size"
  43. :fixed-size="fixedSize"
  44. :name="iconName"
  45. :label="label"
  46. :decorative="decorative"
  47. :animation="animation"
  48. />
  49. </Variant>
  50. </Story>
  51. </template>