1
0
Fork 0
freesewing/sites/shared/components/wrappers/layout.mjs

59 lines
1.5 KiB
JavaScript
Raw Normal View History

2023-09-29 16:01:27 +02:00
// __SDEFILE__ - This file is a dependency for the stand-alone environment
2023-09-29 08:05:40 +02:00
import { nsMerge } from 'shared/utils.mjs'
2023-03-26 16:50:46 +02:00
import Head from 'next/head'
import { Header, ns as headerNs } from 'site/components/header/index.mjs'
import { Footer, ns as footerNs } from 'shared/components/footer/index.mjs'
import { Search, ns as searchNs } from 'site/components/search.mjs'
2023-09-29 08:05:40 +02:00
export const ns = nsMerge(headerNs, footerNs, searchNs)
2022-05-25 18:35:20 +02:00
export const LayoutWrapper = ({
children = [],
search,
setSearch,
noSearch = false,
header = false,
footer = true,
slug,
}) => {
2022-05-25 18:35:20 +02:00
return (
2022-12-03 11:25:02 -06:00
<div
className={`
2022-05-25 18:35:20 +02:00
flex flex-col justify-between
min-h-screen
bg-base-100
2022-12-03 11:25:02 -06:00
`}
>
2023-03-26 16:50:46 +02:00
<Head>
<meta name="viewport" content="width=device-width, initial-scale=1" />
</Head>
{header && <Header slug={slug} />}
<main
className={`grow transition-margin duration-300 ease-in-out
}`}
>
{children}
</main>
2022-05-25 18:35:20 +02:00
{!noSearch && search && (
<>
2022-12-03 11:25:02 -06:00
<div
className={`
w-full max-h-screen bg-base-100 top-0 z-30 pt-0 pb-16 px-8
md:rounded-lg
2022-05-25 18:35:20 +02:00
md:max-w-xl md:m-auto md:inset-x-12
md:max-w-2xl
lg:max-w-4xl
2022-12-03 11:25:02 -06:00
`}
>
<Search search={search} setSearch={setSearch} />
2022-12-03 11:25:02 -06:00
</div>
<div className="fixed top-0 left-0 w-full min-h-screen bg-neutral z-20 bg-opacity-70"></div>
2022-05-25 18:35:20 +02:00
</>
)}
{footer && <Footer />}
2022-05-25 18:35:20 +02:00
</div>
)
}