useBubbleStyleGuide.ts 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. import { computed, type ComputedRef } from 'vue'
  3. export const useBubbleStyleGuide = (
  4. position: ComputedRef<'left' | 'right'>,
  5. isArticleTypeNote: ComputedRef<boolean>,
  6. ) => {
  7. const bodyClasses = computed(() =>
  8. position.value === 'right'
  9. ? ['dark:bg-stone-500', 'bg-blue-100']
  10. : ['dark:bg-gray-400', 'bg-neutral-100'],
  11. )
  12. const dividerClass = computed(() => {
  13. if (position.value === 'right')
  14. return 'border-t border-t-neutral-100 dark:border-t-gray-900'
  15. return 'border-t border-t-neutral-300 dark:border-t-gray-900'
  16. })
  17. const frameBorderClass = computed(() => {
  18. if (isArticleTypeNote.value) return ''
  19. if (position.value === 'right')
  20. return 'border border-neutral-100 dark:border-gray-900'
  21. return 'border border-neutral-300 dark:border-gray-900'
  22. })
  23. const headerAndIconBarBackgroundClass = computed(() =>
  24. position.value === 'right'
  25. ? ['dark:bg-stone-700', 'bg-blue-300']
  26. : ['dark:bg-gray-500', 'bg-neutral-50'],
  27. )
  28. // We need this class otherwise on a transition the edges of children are shown
  29. const articleWrapperBorderClass = computed(() =>
  30. position.value === 'right'
  31. ? 'ltr:rounded-br-none rtl:rounded-bl-none'
  32. : 'ltr:rounded-bl-none rtl:rounded-br-none',
  33. )
  34. const internalNoteClass = computed(() => {
  35. if (!isArticleTypeNote.value) return ''
  36. // Uses `.bg-stripes` class which is defined in `app/frontend/apps/desktop/styles/main.css`.
  37. return position.value === 'right'
  38. ? 'bg-stripes before:rounded-2xl relative z-0 rounded-xl outline outline-1 outline-blue-700 ltr:rounded-br-none rtl:rounded-bl-none ltr:before:rounded-br-none rtl:before:rounded-bl-none'
  39. : 'bg-stripes before:rounded-2xl relative z-0 rounded-xl outline outline-1 outline-blue-700 ltr:rounded-bl-none rtl:rounded-br-none ltr:before:rounded-bl-none rtl:before:rounded-br-none'
  40. })
  41. return {
  42. bodyClasses,
  43. dividerClass,
  44. frameBorderClass,
  45. headerAndIconBarBackgroundClass,
  46. articleWrapperBorderClass,
  47. internalNoteClass,
  48. }
  49. }