chore(dev): Menu tweaks
This commit is contained in:
parent
e4c45e2e9b
commit
4697fbd999
8 changed files with 51 additions and 35 deletions
|
@ -43,12 +43,16 @@ export const Header = ({ app, setSearch }) => {
|
||||||
className={`
|
className={`
|
||||||
btn btn-sm btn-ghost
|
btn btn-sm btn-ghost
|
||||||
text-neutral-content bg-transparent
|
text-neutral-content bg-transparent
|
||||||
hover:text-secondary-focus
|
hover:bg-secondary hover:bg-opacity-50
|
||||||
lg:hidden
|
lg:hidden
|
||||||
|
rounded-none
|
||||||
|
swap swap-rotate
|
||||||
`}
|
`}
|
||||||
onClick={app.togglePrimaryMenu}
|
onClick={() => app.updateState('menu.main', app.state?.menu?.main ? false : true)}
|
||||||
>
|
>
|
||||||
{app.primaryMenu ? <CloseIcon /> : <MenuIcon />}
|
<div className={`${app.state?.menu?.main ? 'rotate-90' : ''} transition-transform`}>
|
||||||
|
{app.state?.menu?.main ? <CloseIcon /> : <MenuIcon />}
|
||||||
|
</div>
|
||||||
</button>
|
</button>
|
||||||
<div className="hidden lg:block">
|
<div className="hidden lg:block">
|
||||||
<WordMark />
|
<WordMark />
|
||||||
|
@ -60,7 +64,7 @@ export const Header = ({ app, setSearch }) => {
|
||||||
<div className="flex flex-row items-center lg:hidden pr-2">
|
<div className="flex flex-row items-center lg:hidden pr-2">
|
||||||
<button
|
<button
|
||||||
onClick={() => setSearch(true)}
|
onClick={() => setSearch(true)}
|
||||||
className="btn btn-sm btn-ghost hover:text-secondary-focus"
|
className="btn btn-sm btn-ghost hover:bg-secondary hover:bg-opacity-50 rounded-none"
|
||||||
>
|
>
|
||||||
<SearchIcon />
|
<SearchIcon />
|
||||||
</button>
|
</button>
|
||||||
|
@ -77,7 +81,9 @@ export const Header = ({ app, setSearch }) => {
|
||||||
onClick={() => setSearch(true)}
|
onClick={() => setSearch(true)}
|
||||||
>
|
>
|
||||||
<SearchIcon />
|
<SearchIcon />
|
||||||
<span className="normal-case text-base font-medium">Ctrl K</span>
|
<keyb className="px-3 rounded text-base font-medium border border-solid border-base-300">
|
||||||
|
/
|
||||||
|
</keyb>
|
||||||
</button>
|
</button>
|
||||||
<ThemePicker app={app} />
|
<ThemePicker app={app} />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -7,20 +7,22 @@ export const AsideNavigation = ({ app, mobileOnly = false, before = [], after =
|
||||||
fixed top-0 right-0 h-screen
|
fixed top-0 right-0 h-screen
|
||||||
overflow-y-auto z-20
|
overflow-y-auto z-20
|
||||||
bg-base-100 text-base-content
|
bg-base-100 text-base-content
|
||||||
${app.state.primaryMenu ? '' : 'translate-x-[-120%]'} transition-transform
|
${app.state?.menu?.main ? '' : 'translate-x-[-120%]'} transition-transform
|
||||||
px-0 pb-20 pt-8 shrink-0
|
px-0 pb-20 pt-8 shrink-0
|
||||||
|
|
||||||
lg:w-auto
|
lg:w-auto
|
||||||
lg:sticky lg:relative lg:transform-none
|
lg:sticky lg:relative lg:transform-none
|
||||||
lg:justify-center
|
lg:justify-center
|
||||||
lg:border-r-2 lg:border-base-200 lg:bg-base-200 lg:bg-opacity-50
|
lg:border-r-2 lg:border-base-200 lg:bg-base-300 lg:bg-opacity-10
|
||||||
lg:mt-16
|
lg:pt-16
|
||||||
${mobileOnly ? 'block lg:hidden w-full ' : ''}
|
${mobileOnly ? 'block lg:hidden w-full ' : ''}
|
||||||
`}
|
`}
|
||||||
>
|
>
|
||||||
|
<div className="w-screen lg:w-auto">
|
||||||
{before}
|
{before}
|
||||||
<MainSections app={app} />
|
<MainSections app={app} />
|
||||||
<ActiveSection app={app} />
|
<ActiveSection app={app} />
|
||||||
{after}
|
{after}
|
||||||
|
</div>
|
||||||
</aside>
|
</aside>
|
||||||
)
|
)
|
||||||
|
|
|
@ -35,9 +35,9 @@ const currentChildren = (current) =>
|
||||||
|
|
||||||
// Shared classes for links
|
// Shared classes for links
|
||||||
// Exported for re-use
|
// Exported for re-use
|
||||||
export const linkClasses = `text-lg lg:text-xl
|
export const linkClasses = `
|
||||||
py-1
|
py-1
|
||||||
text-base-content sm:text-base-content
|
text-base text-base-content sm:text-base-content
|
||||||
hover:text-secondary
|
hover:text-secondary
|
||||||
sm:hover:text-secondary
|
sm:hover:text-secondary
|
||||||
`
|
`
|
||||||
|
@ -180,8 +180,12 @@ export const MainSections = ({ app }) => {
|
||||||
const act = isActive(page.s, app.state.slug)
|
const act = isActive(page.s, app.state.slug)
|
||||||
const txt = (
|
const txt = (
|
||||||
<>
|
<>
|
||||||
{icons[page.s] ? icons[page.s](`w-8 h-8 ${act ? 'text-accent' : ''}`) : <HelpIcon />}
|
{icons[page.s] ? (
|
||||||
<span className={`font-bold ${act ? 'text-accent' : ''}`}>{page.t}</span>
|
icons[page.s](`w-6 h-6 ${act ? 'text-secondary-content' : ''}`)
|
||||||
|
) : (
|
||||||
|
<HelpIcon />
|
||||||
|
)}
|
||||||
|
<span className={`font-bold ${act ? 'text-secondary-content' : ''}`}>{page.t}</span>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -191,10 +195,12 @@ export const MainSections = ({ app }) => {
|
||||||
<span
|
<span
|
||||||
className={`
|
className={`
|
||||||
flex flex-row gap-4 items-center
|
flex flex-row gap-4 items-center
|
||||||
text-accent
|
text-secondary-content
|
||||||
hover:text-base-content
|
hover:text-base-content
|
||||||
p-2 rounded
|
bg-secondary
|
||||||
|
p-2 px-4 rounded
|
||||||
bg-base-200
|
bg-base-200
|
||||||
|
rounded-none
|
||||||
`}
|
`}
|
||||||
title={page.t}
|
title={page.t}
|
||||||
>
|
>
|
||||||
|
@ -205,8 +211,9 @@ export const MainSections = ({ app }) => {
|
||||||
href={`/${page.s}`}
|
href={`/${page.s}`}
|
||||||
className={`
|
className={`
|
||||||
flex flex-row gap-4 items-center
|
flex flex-row gap-4 items-center
|
||||||
hover:bg-secondary hover:bg-opacity-10 hover:cursor-pointer
|
hover:bg-secondary hover:bg-opacity-25 hover:cursor-pointer
|
||||||
p-2 rounded
|
p-2 px-4 rounded
|
||||||
|
rounded-none
|
||||||
`}
|
`}
|
||||||
title={page.t}
|
title={page.t}
|
||||||
>
|
>
|
||||||
|
|
|
@ -8,6 +8,8 @@ import orderBy from 'lodash.orderby'
|
||||||
* - 404 => no navigation shown
|
* - 404 => no navigation shown
|
||||||
* - home page => no navvigation shown
|
* - home page => no navvigation shown
|
||||||
* - /contact => Added below
|
* - /contact => Added below
|
||||||
|
*
|
||||||
|
* Note: Set 'h' to truthy to not show a top-level entry as a section
|
||||||
*/
|
*/
|
||||||
pbn.en.contact = { t: 'Contact information', s: 'contact', h: 1 }
|
pbn.en.contact = { t: 'Contact information', s: 'contact', h: 1 }
|
||||||
|
|
||||||
|
|
|
@ -19,16 +19,11 @@ const No = () => (
|
||||||
</span>
|
</span>
|
||||||
)
|
)
|
||||||
|
|
||||||
const ContactPage = () => {
|
const ContactPage = (props) => {
|
||||||
const app = useApp({
|
const app = useApp(props)
|
||||||
page: {
|
|
||||||
path: ['contact'],
|
|
||||||
},
|
|
||||||
})
|
|
||||||
const title = 'Contact information'
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<PageWrapper app={app} title={title} slug="contact" crumbs={[[title, 'contact']]}>
|
<PageWrapper app={app}>
|
||||||
<Head>
|
<Head>
|
||||||
<meta property="og:type" content="article" key="type" />
|
<meta property="og:type" content="article" key="type" />
|
||||||
<meta
|
<meta
|
||||||
|
@ -220,6 +215,9 @@ export async function getStaticProps() {
|
||||||
return {
|
return {
|
||||||
props: {
|
props: {
|
||||||
...(await serverSideTranslations('en')),
|
...(await serverSideTranslations('en')),
|
||||||
|
page: {
|
||||||
|
path: ['contact'],
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ export const AsideNavigation = ({ app, slug, mobileOnly = false, before = [], af
|
||||||
overflow-y-auto z-20
|
overflow-y-auto z-20
|
||||||
bg-base-100 text-base-content md:bg-base-50
|
bg-base-100 text-base-content md:bg-base-50
|
||||||
transition-all
|
transition-all
|
||||||
${app.primaryMenu ? '' : 'translate-x-[-120%]'} transition-transform
|
${app.state?.menu?.main ? '' : 'translate-x-[-120%]'} transition-transform
|
||||||
md:flex md:sticky md:flex-row-reverse
|
md:flex md:sticky md:flex-row-reverse
|
||||||
md:relative md:transform-none
|
md:relative md:transform-none
|
||||||
px-6 py-24
|
px-6 py-24
|
||||||
|
|
|
@ -16,7 +16,8 @@ export const ThemePicker = ({ app, iconOnly = false, bottom = false }) => {
|
||||||
{() => (
|
{() => (
|
||||||
<>
|
<>
|
||||||
<Popover.Button
|
<Popover.Button
|
||||||
className={`h-12 group border-0 inline-flex items-center px-3 text-base text-neural-content hover:bg-neutral-focus`}
|
className={`h-12 group border-0 inline-flex items-center px-3 text-base
|
||||||
|
text-neural-content hover:bg-secondary hover:bg-opacity-50`}
|
||||||
>
|
>
|
||||||
<ThemeIcon />
|
<ThemeIcon />
|
||||||
{!iconOnly && (
|
{!iconOnly && (
|
||||||
|
|
|
@ -32,8 +32,8 @@ export const PageWrapper = ({
|
||||||
* Swipe handling for the entire site
|
* Swipe handling for the entire site
|
||||||
*/
|
*/
|
||||||
const swipeHandlers = useSwipeable({
|
const swipeHandlers = useSwipeable({
|
||||||
onSwipedLeft: () => (app.primaryMenu ? app.setPrimaryMenu(false) : null),
|
onSwipedLeft: () => (app.state?.menu?.main ? app.updateState('menu.main', false) : null),
|
||||||
onSwipedRight: () => (app.primaryMenu ? null : app.setPrimaryMenu(true)),
|
onSwipedRight: () => (app.state?.menu?.main ? null : app.updateState('menu.main', true)),
|
||||||
trackMouse: true,
|
trackMouse: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ export const PageWrapper = ({
|
||||||
// Always close modal when Escape key is hit
|
// Always close modal when Escape key is hit
|
||||||
useHotkeys('esc', (evt) => {
|
useHotkeys('esc', (evt) => {
|
||||||
evt.preventDefault()
|
evt.preventDefault()
|
||||||
app.setModal(false)
|
app.updateState('modal', null)
|
||||||
})
|
})
|
||||||
|
|
||||||
// Search state
|
// Search state
|
||||||
|
@ -63,7 +63,7 @@ export const PageWrapper = ({
|
||||||
setSearch,
|
setSearch,
|
||||||
toggleSearch: () => setSearch(!search),
|
toggleSearch: () => setSearch(!search),
|
||||||
noSearch: noSearch,
|
noSearch: noSearch,
|
||||||
title,
|
title: app.state.title ? app.state.title : title,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make layout prop into a (uppercase) component
|
// Make layout prop into a (uppercase) component
|
||||||
|
@ -87,7 +87,7 @@ export const PageWrapper = ({
|
||||||
bg-base-100 bg-opacity-90 z-50 hover:cursor-pointer
|
bg-base-100 bg-opacity-90 z-50 hover:cursor-pointer
|
||||||
flex flex-row items-center justify-center
|
flex flex-row items-center justify-center
|
||||||
`}
|
`}
|
||||||
onClick={() => app.setModal(false)}
|
onClick={() => app.updateState('modal', false)}
|
||||||
>
|
>
|
||||||
{app.modal}
|
{app.modal}
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue