Merge pull request #11 from tmshv/fix/body-wrapper
body wrapper refactoring
This commit is contained in:
5 files changed
+64
-41
No files matched your search
+13
-10
@@ -1,9 +1,19 @@
|
|||||||
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}
|
||||||
|
footer={(
|
||||||
|
<footer className="footer--centered">
|
||||||
|
<div className="copyright">
|
||||||
|
<span>© 2012—2019 Шлиссельбургская детская художественная школа</span>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
)}
|
||||||
|
>
|
||||||
<section className="error-404">
|
<section className="error-404">
|
||||||
<div>
|
<div>
|
||||||
<h1>Страница не найдена.</h1>
|
<h1>Страница не найдена.</h1>
|
||||||
@@ -12,14 +22,7 @@ const Page: NextPage = () => (
|
|||||||
|
|
||||||
<div><a href="/">На главную</a></div>
|
<div><a href="/">На главную</a></div>
|
||||||
</section>
|
</section>
|
||||||
</main>
|
</Wrapper>
|
||||||
|
|
||||||
<footer className="footer--centered">
|
|
||||||
<div className="copyright">
|
|
||||||
<span>© 2012—2019 Шлиссельбургская детская художественная школа</span>
|
|
||||||
</div>
|
|
||||||
</footer>
|
|
||||||
</div>
|
|
||||||
)
|
)
|
||||||
|
|
||||||
export default Page
|
export default Page
|
||||||
@@ -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
|
||||||
@@ -23,7 +22,8 @@ export const App: React.FC<IAppProps> = props => {
|
|||||||
const motionDisabled = useReducedMotion()
|
const motionDisabled = useReducedMotion()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="body-wrapper theme-default">
|
<Wrapper
|
||||||
|
header={(
|
||||||
<header>
|
<header>
|
||||||
<div className="navigation">
|
<div className="navigation">
|
||||||
<div className="navigation__body">
|
<div className="navigation__body">
|
||||||
@@ -33,8 +33,16 @@ export const App: React.FC<IAppProps> = props => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
)}
|
||||||
<main className="body-wrapper__content">
|
footer={(
|
||||||
|
<Footer
|
||||||
|
showAuthor={props.showAuthor}
|
||||||
|
address=" г. Шлиссельбург ул. 18 января д. 3"
|
||||||
|
telephone="+7 (81362) 76-312"
|
||||||
|
email="hudozka@gmail.com"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
>
|
||||||
<section className={cx('content', `content_${props.layout}`, {
|
<section className={cx('content', `content_${props.layout}`, {
|
||||||
'content--padding-top--menu': props.menuPadding,
|
'content--padding-top--menu': props.menuPadding,
|
||||||
'reduced-motion': motionDisabled,
|
'reduced-motion': motionDisabled,
|
||||||
@@ -43,14 +51,6 @@ export const App: React.FC<IAppProps> = props => {
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<Comments />
|
<Comments />
|
||||||
</main>
|
</Wrapper>
|
||||||
|
|
||||||
<Footer
|
|
||||||
showAuthor={props.showAuthor}
|
|
||||||
address=" г. Шлиссельбург ул. 18 января д. 3"
|
|
||||||
telephone="+7 (81362) 76-312"
|
|
||||||
email="hudozka@gmail.com"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -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>
|
||||||
|
)
|
||||||
@@ -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;
|
|
||||||
}
|
|
||||||
@@ -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";
|
||||||
|
|||||||
Reference in new issue
Block a user