layoutStore.ts 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. return {
  23. isHeaderVisible,
  24. setIsHeaderVisible,
  25. isBannerVisible,
  26. setIsBannerVisible,
  27. isFooterVisible,
  28. setIsFooterVisible,
  29. isAnchoredSectionOnScreen,
  30. resetAnchoredSections,
  31. setIsAnchoredSectionOnScreen,
  32. };
  33. });