2023-04-25 17:33:34 +02:00
|
|
|
// Hooks
|
2023-06-20 16:52:00 -05:00
|
|
|
import { useContext } from 'react'
|
2023-04-25 17:33:34 +02:00
|
|
|
import { useTranslation } from 'next-i18next'
|
|
|
|
// Context
|
|
|
|
import { ModalContext } from 'shared/context/modal-context.mjs'
|
|
|
|
// Components
|
2023-04-07 17:10:54 +02:00
|
|
|
import {
|
|
|
|
DesignIcon,
|
|
|
|
DocsIcon,
|
|
|
|
MenuIcon,
|
|
|
|
SearchIcon,
|
|
|
|
ShowcaseIcon,
|
|
|
|
UserIcon,
|
|
|
|
ThemeIcon,
|
|
|
|
I18nIcon,
|
2023-06-15 18:33:30 +02:00
|
|
|
MeasieIcon,
|
2023-04-30 21:24:35 +02:00
|
|
|
PageIcon,
|
2023-07-15 16:55:22 +02:00
|
|
|
RssIcon,
|
2023-04-07 17:10:54 +02:00
|
|
|
} from 'shared/components/icons.mjs'
|
2023-06-20 16:52:00 -05:00
|
|
|
import { HeaderWrapper } from 'shared/components/wrappers/header.mjs'
|
2023-04-19 20:11:52 +02:00
|
|
|
import { ModalThemePicker, ns as themeNs } from 'shared/components/modal/theme-picker.mjs'
|
|
|
|
import { ModalLocalePicker, ns as localeNs } from 'shared/components/modal/locale-picker.mjs'
|
2023-04-09 15:57:25 +02:00
|
|
|
import { ModalMenu } from 'site/components/navigation/modal-menu.mjs'
|
2022-01-02 17:16:15 +01:00
|
|
|
|
2023-05-18 13:56:50 +02:00
|
|
|
import { NavButton, NavSpacer, colors } from 'shared/components/header.mjs'
|
2023-04-07 17:10:54 +02:00
|
|
|
|
2023-05-08 19:28:03 +02:00
|
|
|
export const ns = ['header', 'sections', ...themeNs, ...localeNs]
|
2023-04-09 15:57:25 +02:00
|
|
|
|
2023-04-28 21:23:06 +02:00
|
|
|
const NavIcons = ({ setModal, setSearch }) => {
|
2023-04-07 17:10:54 +02:00
|
|
|
const { t } = useTranslation(['header'])
|
|
|
|
const iconSize = 'h-6 w-6 lg:h-12 lg:w-12'
|
|
|
|
|
|
|
|
return (
|
|
|
|
<>
|
2023-07-26 08:47:28 +02:00
|
|
|
<NavButton
|
|
|
|
onClick={() => setModal(<ModalMenu />)}
|
|
|
|
label={t('header:menu')}
|
|
|
|
color={colors[0]}
|
|
|
|
extraClasses="md:px-4 lg:px-0"
|
|
|
|
>
|
2023-04-07 17:10:54 +02:00
|
|
|
<MenuIcon className={iconSize} />
|
|
|
|
</NavButton>
|
|
|
|
<NavSpacer />
|
2023-05-08 19:28:03 +02:00
|
|
|
<NavButton href="/designs" label={t('header:designs')} color={colors[1]}>
|
2023-04-07 17:10:54 +02:00
|
|
|
<DesignIcon className={iconSize} />
|
|
|
|
</NavButton>
|
|
|
|
<NavButton
|
2023-07-15 16:55:22 +02:00
|
|
|
href="/docs"
|
|
|
|
label={t('header:docs')}
|
2023-05-08 19:28:03 +02:00
|
|
|
color={colors[2]}
|
2023-07-26 08:47:28 +02:00
|
|
|
extraClasses="hidden md:flex"
|
2023-04-07 17:10:54 +02:00
|
|
|
>
|
2023-07-15 16:55:22 +02:00
|
|
|
<DocsIcon className={iconSize} />
|
2023-04-07 17:10:54 +02:00
|
|
|
</NavButton>
|
2023-04-09 15:57:25 +02:00
|
|
|
<NavButton
|
2023-07-15 16:55:22 +02:00
|
|
|
href="/blog"
|
|
|
|
label={t('header:blog')}
|
2023-05-08 19:28:03 +02:00
|
|
|
color={colors[3]}
|
2023-07-26 08:47:28 +02:00
|
|
|
extraClasses="hidden md:flex"
|
2023-04-09 15:57:25 +02:00
|
|
|
>
|
2023-07-15 16:55:22 +02:00
|
|
|
<RssIcon className={iconSize} />
|
2023-04-07 17:10:54 +02:00
|
|
|
</NavButton>
|
2023-04-09 15:57:25 +02:00
|
|
|
<NavButton
|
2023-04-30 21:24:35 +02:00
|
|
|
href="/showcase"
|
|
|
|
label={t('header:showcase')}
|
2023-05-08 19:28:03 +02:00
|
|
|
color={colors[4]}
|
2023-07-26 08:47:28 +02:00
|
|
|
extraClasses="hidden md:flex"
|
2023-04-09 15:57:25 +02:00
|
|
|
>
|
2023-04-30 21:24:35 +02:00
|
|
|
<ShowcaseIcon className={iconSize} />
|
2023-04-07 17:10:54 +02:00
|
|
|
</NavButton>
|
2023-07-15 16:55:22 +02:00
|
|
|
<NavSpacer />
|
2023-04-07 17:10:54 +02:00
|
|
|
<NavButton
|
2023-07-15 16:55:22 +02:00
|
|
|
href="/patterns"
|
|
|
|
label={t('header:patterns')}
|
2023-05-08 19:28:03 +02:00
|
|
|
color={colors[5]}
|
2023-04-07 17:10:54 +02:00
|
|
|
extraClasses="hidden lg:flex"
|
|
|
|
>
|
2023-07-15 16:55:22 +02:00
|
|
|
<PageIcon className={iconSize} />
|
|
|
|
</NavButton>
|
|
|
|
<NavButton
|
|
|
|
href="/sets"
|
|
|
|
label={t('header:sets')}
|
|
|
|
color={colors[6]}
|
|
|
|
extraClasses="hidden lg:flex"
|
|
|
|
>
|
|
|
|
<MeasieIcon className={iconSize} />
|
|
|
|
</NavButton>
|
|
|
|
<NavButton href="/account" label={t('header:account')} color={colors[7]}>
|
|
|
|
<UserIcon className={iconSize} />
|
2023-04-07 17:10:54 +02:00
|
|
|
</NavButton>
|
|
|
|
<NavSpacer />
|
|
|
|
<NavButton
|
2023-04-28 21:23:06 +02:00
|
|
|
onClick={() => setModal(<ModalThemePicker />)}
|
2023-04-07 17:10:54 +02:00
|
|
|
label={t('header:theme')}
|
2023-07-15 16:55:22 +02:00
|
|
|
color={colors[8]}
|
2023-04-07 17:10:54 +02:00
|
|
|
>
|
|
|
|
<ThemeIcon className={iconSize} />
|
|
|
|
</NavButton>
|
2023-04-07 17:33:45 +02:00
|
|
|
<NavButton
|
2023-04-28 21:23:06 +02:00
|
|
|
onClick={() => setModal(<ModalLocalePicker />)}
|
2023-04-07 17:33:45 +02:00
|
|
|
label={t('header:language')}
|
2023-07-15 16:55:22 +02:00
|
|
|
color={colors[9]}
|
2023-04-07 17:33:45 +02:00
|
|
|
>
|
2023-04-07 17:10:54 +02:00
|
|
|
<I18nIcon className={iconSize} />
|
|
|
|
</NavButton>
|
2023-07-26 08:47:28 +02:00
|
|
|
<NavButton
|
|
|
|
onClick={() => setSearch(true)}
|
|
|
|
label={t('header:search')}
|
|
|
|
color={colors[10]}
|
|
|
|
extraClasses="md:px-4 lg:px-0"
|
|
|
|
>
|
2023-04-07 17:10:54 +02:00
|
|
|
<SearchIcon className={iconSize} />
|
|
|
|
</NavButton>
|
|
|
|
</>
|
|
|
|
)
|
|
|
|
}
|
2023-01-28 18:10:29 +01:00
|
|
|
|
2023-06-20 16:52:00 -05:00
|
|
|
export const Header = ({ setSearch, show }) => {
|
2023-04-25 17:33:34 +02:00
|
|
|
const { setModal } = useContext(ModalContext)
|
2022-01-02 17:16:15 +01:00
|
|
|
return (
|
2023-06-20 16:52:00 -05:00
|
|
|
<HeaderWrapper setSearch={setSearch} show={show}>
|
2023-07-26 08:47:28 +02:00
|
|
|
<div className="m-auto lg:px-4">
|
2022-12-24 18:16:09 +01:00
|
|
|
<div className="p-0 flex flex-row gap-2 justify-between text-neutral-content items-center">
|
2023-04-07 17:10:54 +02:00
|
|
|
{/* Non-mobile content */}
|
2023-07-26 08:47:28 +02:00
|
|
|
<div className="hidden md:flex md:flex-row md:justify-between items-center xl:justify-center w-full">
|
2023-04-28 21:23:06 +02:00
|
|
|
<NavIcons setModal={setModal} setSearch={setSearch} />
|
2022-11-23 21:42:22 +01:00
|
|
|
</div>
|
2023-04-07 17:10:54 +02:00
|
|
|
|
|
|
|
{/* Mobile content */}
|
2023-07-26 08:47:28 +02:00
|
|
|
<div className="flex md:hidden flex-row items-center justify-between w-full">
|
2023-04-28 21:23:06 +02:00
|
|
|
<NavIcons setModal={setModal} setSearch={setSearch} />
|
2022-01-02 17:16:15 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
2022-11-23 21:42:22 +01:00
|
|
|
</div>
|
2023-06-20 16:52:00 -05:00
|
|
|
</HeaderWrapper>
|
2022-01-02 17:16:15 +01:00
|
|
|
)
|
|
|
|
}
|