feat(org): Ported components to mjs and named exports
This commit is contained in:
parent
37f7833983
commit
595417a23b
118 changed files with 836 additions and 852 deletions
|
@ -1,55 +0,0 @@
|
|||
import React, { useState, useEffect } from 'react'
|
||||
import { useSwipeable } from 'react-swipeable'
|
||||
import { useRouter } from 'next/router'
|
||||
import { useHotkeys } from 'react-hotkeys-hook'
|
||||
// Shared components
|
||||
import Layout from 'shared/components/layouts/default'
|
||||
|
||||
/* This component should wrap all page content */
|
||||
const PageWrapper= props => {
|
||||
|
||||
const swipeHandlers = useSwipeable({
|
||||
onSwipedLeft: evt => (props.app.primaryMenu) ? props.app.setPrimaryMenu(false) : null,
|
||||
onSwipedRight: evt => (props.app.primaryMenu) ? null : props.app.setPrimaryMenu(true),
|
||||
trackMouse: true
|
||||
})
|
||||
|
||||
const router = useRouter()
|
||||
const slug = router.asPath.slice(1)
|
||||
|
||||
useEffect(() => props.app.setSlug(slug), [slug])
|
||||
|
||||
// Trigger search with Ctrl+k
|
||||
useHotkeys('ctrl+k', (evt) => {
|
||||
evt.preventDefault()
|
||||
setSearch(true)
|
||||
})
|
||||
|
||||
const [search, setSearch] = useState(false)
|
||||
|
||||
const childProps = {
|
||||
app: props.app,
|
||||
title: props.title,
|
||||
search, setSearch, toggleSearch: () => setSearch(!search),
|
||||
noSearch: props.noSearch,
|
||||
workbench: props.workbench,
|
||||
AltMenu: props.AltMenu || null
|
||||
}
|
||||
|
||||
return (
|
||||
<div
|
||||
ref={swipeHandlers.ref}
|
||||
onMouseDown={swipeHandlers.onMouseDown}
|
||||
data-theme={props.app.theme}
|
||||
key={props.app.theme} // Thiis forces the data-theme update
|
||||
>
|
||||
{props.noLayout
|
||||
? props.children
|
||||
: <Layout {...childProps}>{props.children}</Layout>
|
||||
}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default PageWrapper
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue