2023-09-04 08:40:05 +02:00
|
|
|
// Context
|
|
|
|
import { LoadingStatusContext } from 'shared/context/loading-status-context.mjs'
|
2023-06-20 16:52:00 -05:00
|
|
|
// Hooks
|
|
|
|
import { useContext } from 'react'
|
|
|
|
import { Ribbon } from 'shared/components/ribbon.mjs'
|
|
|
|
|
2023-06-21 12:29:19 +02:00
|
|
|
export const HeaderWrapper = ({ show, children }) => {
|
2023-09-04 08:40:05 +02:00
|
|
|
const { loading } = useContext(LoadingStatusContext)
|
2023-06-20 16:52:00 -05:00
|
|
|
return (
|
|
|
|
<header
|
|
|
|
className={`
|
2023-07-26 08:47:28 +02:00
|
|
|
fixed bottom-0 md:bottom-auto md:top-0 left-0
|
2023-06-20 16:52:00 -05:00
|
|
|
bg-neutral
|
|
|
|
w-full
|
|
|
|
z-30
|
|
|
|
transition-transform
|
|
|
|
duration-300 ease-in-out
|
2023-07-26 08:47:28 +02:00
|
|
|
${show || loading ? '' : 'translate-y-36 md:-translate-y-36'}
|
2023-06-20 16:52:00 -05:00
|
|
|
drop-shadow-xl
|
|
|
|
`}
|
|
|
|
>
|
|
|
|
{' '}
|
|
|
|
{children}
|
|
|
|
<Ribbon />
|
|
|
|
</header>
|
|
|
|
)
|
|
|
|
}
|
2023-06-23 14:29:09 -05:00
|
|
|
|
2023-06-29 15:44:23 +00:00
|
|
|
// can't use string interpolation or tailwind won't account for these classes
|
2023-06-29 14:35:46 +00:00
|
|
|
const shownHeaderClasses = {
|
|
|
|
'bottom-16': 'group-[.header-shown]/layout:bottom-16',
|
2023-07-26 08:47:28 +02:00
|
|
|
'md:top-24': 'group-[.header-shown]/layout:md:top-24',
|
2023-06-29 14:35:46 +00:00
|
|
|
}
|
|
|
|
export const shownHeaderSelector = (cls) => shownHeaderClasses[cls]
|