CommonIcon.story.vue 1.6 KB

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