body wrapper refactoring

This commit is contained in:
tmshv committed 2020-02-17 19:45:34 +03:00
1 parent be60011567
commit 018b1fa8ba
5 files changed
+87 -64

No files matched your search

+34 -34
View File
@@ -1,17 +1,16 @@
import * as React from 'react'
import 'src/style/style.scss'
import dynamic from 'next/dynamic'
import cx from 'classnames'
import { Footer } from '../Footer'
import Comments from '../Comments'
import { useReducedMotion } from '../../hooks/useReducedMotion'
import { useReducedMotion } from 'src/hooks/useReducedMotion'
import { Wrapper } from '../Wrapper'
const Header = dynamic(() => import('./Header'), {
ssr: false,
})
import '../../style/style.scss'
export interface IAppProps {
menu: any
showAuthor: boolean
@@ -21,36 +20,37 @@ export interface IAppProps {
export const App: React.FC<IAppProps> = props => {
const motionDisabled = useReducedMotion()
return (
<div className="body-wrapper theme-default">
<header>
<div className="navigation">
<div className="navigation__body">
<Header
menuItems={props.menu.items}
/>
<Wrapper
header={(
<header>
<div className="navigation">
<div className="navigation__body">
<Header
menuItems={props.menu.items}
/>
</div>
</div>
</div>
</header>
</header>
)}
footer={(
<Footer
showAuthor={props.showAuthor}
address=" г. Шлиссельбург ул. 18 января д. 3"
telephone="+7 (81362) 76-312"
email="hudozka@gmail.com"
/>
)}
>
<section className={cx('content', `content_${props.layout}`, {
'content--padding-top--menu': props.menuPadding,
'reduced-motion': motionDisabled,
})}>
{props.children}
</section>
<main className="body-wrapper__content">
<section className={cx('content', `content_${props.layout}`, {
'content--padding-top--menu': props.menuPadding,
'reduced-motion': motionDisabled,
})}>
{props.children}
</section>
<Comments />
</main>
<Footer
showAuthor={props.showAuthor}
address=" г. Шлиссельбург ул. 18 января д. 3"
telephone="+7 (81362) 76-312"
email="hudozka@gmail.com"
/>
</div>
<Comments />
</Wrapper>
)
}
}
+34
View File
@@ -0,0 +1,34 @@
import cx from 'classnames'
export type WrapperProps = {
header: React.ReactNode
footer: React.ReactNode
}
export const Wrapper: React.FC<WrapperProps> = props => (
<div className={cx('wrapper', 'theme-default')}>
<style jsx>{`
.wrapper {
display: flex;
flex-direction: column;
min-height: 100vh;
background-color: white;
font-family: var(--text-font);
font-size: var(--font-size-default);
}
.content {
flex: 1;
}
`}</style>
{props.header}
<main className={'content'}>
{props.children}
</main>
{props.footer}
</div>
)