layoutStore.ts 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import type { Ref } from "@vue/reactivity";
  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. return {
  23. isHeaderVisible,
  24. setIsHeaderVisible,
  25. isBannerVisible,
  26. setIsBannerVisible,
  27. isFooterVisible,
  28. setIsFooterVisible,
  29. isAnchoredSectionOnScreen,
  30. resetAnchoredSections,
  31. setIsAnchoredSectionOnScreen
  32. }
  33. })