layoutStore.ts 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import type { Ref } from 'vue'
  2. export const useLayoutStore = defineStore('layout', () => {
  3. const isHeaderVisible: Ref<boolean> = ref(false)
  4. const setIsHeaderVisible = (value: boolean) => {
  5. isHeaderVisible.value = value
  6. }
  7. const isBannerVisible: Ref<boolean> = ref(false)
  8. const setIsBannerVisible = (value: boolean) => {
  9. isFooterVisible.value = value
  10. }
  11. const isFooterVisible: Ref<boolean> = ref(false)
  12. const setIsFooterVisible = (value: boolean) => {
  13. isFooterVisible.value = value
  14. }
  15. const resetAnchoredSections = () => {
  16. isAnchoredSectionOnScreen.value = {}
  17. }
  18. const isAnchoredSectionOnScreen: Ref<Record<string, boolean>> = ref({})
  19. const setIsAnchoredSectionOnScreen = (sectionId: string, value: boolean) => {
  20. isAnchoredSectionOnScreen.value[sectionId] = value
  21. }
  22. const isCookieConsentDialogVisible: Ref<boolean> = ref(false)
  23. const setIsCookieConsentDialogVisible = (value: boolean) => {
  24. isCookieConsentDialogVisible.value = value
  25. }
  26. return {
  27. isHeaderVisible,
  28. setIsHeaderVisible,
  29. isBannerVisible,
  30. setIsBannerVisible,
  31. isFooterVisible,
  32. setIsFooterVisible,
  33. isAnchoredSectionOnScreen,
  34. resetAnchoredSections,
  35. setIsAnchoredSectionOnScreen,
  36. isCookieConsentDialogVisible,
  37. setIsCookieConsentDialogVisible,
  38. }
  39. })