Message.vue 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <template>
  2. <!-- TODO: add animations -->
  3. <div class="px-6 py-2 flex gap-3 items-center bg-green-900 rounded-xl border-[1px] border-green-700 hover:border-green-500 duration-150">
  4. <Icon :name="properties.icon" class="h-7 w-7" :class="properties.color" />
  5. <p v-if="props.text" v-text="props.text" class="text-xl" :class="properties.color" />
  6. <slot />
  7. </div>
  8. </template>
  9. <script setup lang="ts">
  10. const props = withDefaults(
  11. defineProps<{
  12. type?: "done" | "warn" | "danger";
  13. icon?: boolean;
  14. text?: string;
  15. }>(),
  16. {
  17. type: "done",
  18. icon: true,
  19. }
  20. );
  21. const properties = computed(() => {
  22. switch (props.type) {
  23. case "done":
  24. // TODO: add accent and secondary
  25. return {
  26. icon: "weui:done2-outlined",
  27. color: "text-green-400"
  28. }
  29. case 'warn':
  30. return {
  31. icon: "ion:warning-outline",
  32. color: "text-yellow-400"
  33. }
  34. case 'danger':
  35. return {
  36. icon: "weui:close2-outlined",
  37. color: "text-red-400"
  38. }
  39. }
  40. })
  41. console.log(properties.value)
  42. </script>