Merge pull request #11 from tmshv/fix/body-wrapper

body wrapper refactoring
This commit is contained in:
tmshv authored and GitHub committed 2020-02-17 20:03:43 +03:00
commit 6dfacb56c9
5 files changed
+87 -64

No files matched your search

+19 -16
View File
@@ -1,25 +1,28 @@
import 'src/style/style.scss' import 'src/style/style.scss'
import { NextPage } from 'next' import { NextPage } from 'next'
import { Wrapper } from 'src/components/Wrapper'
const Page: NextPage = () => ( const Page: NextPage = () => (
<div className="body-wrapper"> <Wrapper
<main className="body-wrapper__content"> header={null}
<section className="error-404"> footer={(
<div> <footer className="footer--centered">
<h1>Страница не найдена.</h1> <div className="copyright">
<img src="/static/graphics/skull.jpg" /> <span>©&nbsp;2012—2019 Шлиссельбургская детская художественная школа</span>
</div> </div>
</footer>
<div><a href="/">На главную</a></div> )}
</section> >
</main> <section className="error-404">
<div>
<footer className="footer--centered"> <h1>Страница не найдена.</h1>
<div className="copyright"> <img src="/static/graphics/skull.jpg" />
<span>©&nbsp;2012—2019 Шлиссельбургская детская художественная школа</span>
</div> </div>
</footer>
</div> <div><a href="/">На главную</a></div>
</section>
</Wrapper>
) )
export default Page export default Page
+34 -34
View File
@@ -1,17 +1,16 @@
import * as React from 'react' import 'src/style/style.scss'
import dynamic from 'next/dynamic' import dynamic from 'next/dynamic'
import cx from 'classnames' import cx from 'classnames'
import { Footer } from '../Footer' import { Footer } from '../Footer'
import Comments from '../Comments' import Comments from '../Comments'
import { useReducedMotion } from '../../hooks/useReducedMotion' import { useReducedMotion } from 'src/hooks/useReducedMotion'
import { Wrapper } from '../Wrapper'
const Header = dynamic(() => import('./Header'), { const Header = dynamic(() => import('./Header'), {
ssr: false, ssr: false,
}) })
import '../../style/style.scss'
export interface IAppProps { export interface IAppProps {
menu: any menu: any
showAuthor: boolean showAuthor: boolean
@@ -21,36 +20,37 @@ export interface IAppProps {
export const App: React.FC<IAppProps> = props => { export const App: React.FC<IAppProps> = props => {
const motionDisabled = useReducedMotion() const motionDisabled = useReducedMotion()
return ( return (
<div className="body-wrapper theme-default"> <Wrapper
<header> header={(
<div className="navigation"> <header>
<div className="navigation__body"> <div className="navigation">
<Header <div className="navigation__body">
menuItems={props.menu.items} <Header
/> menuItems={props.menu.items}
/>
</div>
</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"> <Comments />
<section className={cx('content', `content_${props.layout}`, { </Wrapper>
'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>
) )
} }
+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>
)
-13
View File
@@ -1,13 +0,0 @@
.body-wrapper {
display: flex;
flex-direction: column;
min-height: 100vh;
background-color: white;
font-family: var(--text-font);
font-size: var(--font-size-default);
}
.body-wrapper__content {
flex: 1;
}
-1
View File
@@ -17,7 +17,6 @@
@import "components/ArticleTags"; @import "components/ArticleTags";
@import "body-wrapper";
@import "content"; @import "content";
@import "page-animation"; @import "page-animation";
@import "main-image"; @import "main-image";