-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into fix/fe/FSADT1-1086
- Loading branch information
Showing
17 changed files
with
377 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { useIntersectionObserver } from "@vueuse/core"; | ||
import { ref } from "vue"; | ||
import type { Ref } from "vue"; | ||
|
||
const isClient = typeof window !== 'undefined' && typeof document !== 'undefined'; | ||
const defaultWindow = isClient ? window : void 0; | ||
|
||
// Based on @vueuse/core | ||
export default function useElementVisibility(element, options = {}) { | ||
const { window = defaultWindow, scrollTarget, threshold } = options; | ||
const elementIsVisible = ref<boolean>(undefined); | ||
|
||
let done: () => void; | ||
const elementIsVisibleRefPromise = new Promise<Ref<boolean>>((resolve) => { | ||
done = () => { | ||
resolve(elementIsVisible); | ||
}; | ||
}); | ||
const { stop } = useIntersectionObserver( | ||
element, | ||
(intersectionObserverEntries) => { | ||
let isIntersecting = elementIsVisible.value | ||
|
||
// Get the latest value of isIntersecting based on the entry time | ||
let latestTime = 0; | ||
for (const entry of intersectionObserverEntries) { | ||
if (entry.time >= latestTime) { | ||
latestTime = entry.time; | ||
isIntersecting = entry.isIntersecting; | ||
} | ||
} | ||
elementIsVisible.value = isIntersecting; | ||
|
||
// signalize the value is ready | ||
done(); | ||
}, | ||
{ | ||
root: scrollTarget, | ||
window, | ||
threshold, | ||
} | ||
); | ||
return { elementIsVisibleRefPromise, stop }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import { useMediaQuery } from '@vueuse/core'; | ||
import { useMediaQuery } from "@vueuse/core"; | ||
|
||
export const isSmallScreen = useMediaQuery('(max-width: 671px)') | ||
export const isMediumScreen = useMediaQuery('(min-width: 672px) and (max-width: 1055px)') | ||
export const isSmallScreen = useMediaQuery("(max-width: 671px)"); | ||
export const isMediumScreen = useMediaQuery("(min-width: 672px) and (max-width: 1055px)"); | ||
export const isTouchScreen = useMediaQuery("(hover: none)"); |
Oops, something went wrong.