about summary refs log tree commit diff
path: root/src/tours/positioning.web.ts
blob: fd0f7aa7144a97073d39be78b0d242a5f02d5d6a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import {useWindowDimensions} from 'react-native'

import {useWebMediaQueries} from '#/lib/hooks/useWebMediaQueries'
import {useShellLayout} from '#/state/shell/shell-layout'

export function useHeaderPosition() {
  const {headerHeight} = useShellLayout()
  const winDim = useWindowDimensions()
  const {isMobile} = useWebMediaQueries()

  let left = 0
  let width = winDim.width
  if (width > 590 && !isMobile) {
    left = winDim.width / 2 - 295
    width = 590
  }

  let offset = isMobile ? 45 : 0

  return {
    top: headerHeight.value - offset,
    left,
    width,
    height: 45,
    borderRadiusObject: undefined,
  }
}