Merged in feature/SW-2320-languagebased-hide-for-next-release (pull request #1937)
Language based alternative to HIDE_FOR_NEXT_RELEASE Approved-by: Anton Gunnarsson
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
|
||||
import { useCallback, useEffect, useState } from "react"
|
||||
|
||||
import { env } from "@/env/client"
|
||||
import useStickyPositionStore, {
|
||||
type StickyElement,
|
||||
type StickyElementNameEnum,
|
||||
@@ -10,6 +9,8 @@ import useStickyPositionStore, {
|
||||
|
||||
import { debounce } from "@/utils/debounce"
|
||||
|
||||
import { useIsLangLive } from "./useIsLangLive"
|
||||
|
||||
interface UseStickyPositionProps {
|
||||
ref?: React.RefObject<HTMLElement>
|
||||
name?: StickyElementNameEnum
|
||||
@@ -46,6 +47,7 @@ export default function useStickyPosition({
|
||||
getAllElements,
|
||||
} = useStickyPositionStore()
|
||||
|
||||
const isLangLive = useIsLangLive()
|
||||
/* Used for Current mobile header since that doesn't use this hook.
|
||||
*
|
||||
* Instead, calculate if the mobile header is shown and add the height of
|
||||
@@ -123,7 +125,7 @@ export default function useStickyPosition({
|
||||
updateHeights()
|
||||
|
||||
// Only do this special handling if we have the current header
|
||||
if (env.NEXT_PUBLIC_HIDE_FOR_NEXT_RELEASE) {
|
||||
if (!isLangLive) {
|
||||
if (document.body.clientWidth > 950) {
|
||||
setBaseTopOffset(0)
|
||||
} else {
|
||||
@@ -142,7 +144,7 @@ export default function useStickyPosition({
|
||||
resizeObserver.unobserve(document.body)
|
||||
}
|
||||
}
|
||||
}, [updateHeights])
|
||||
}, [updateHeights, isLangLive])
|
||||
|
||||
return {
|
||||
currentHeight: ref?.current?.offsetHeight || null,
|
||||
|
||||
Reference in New Issue
Block a user