App component update; support reduced-motion
This commit is contained in:
1 parent
96c1330d9b
commit
228e7824de
3 files changed
+29
-7
No files matched your search
+2
-2
@@ -1,5 +1,6 @@
|
|||||||
import React from 'react'
|
import React from 'react'
|
||||||
import Head from 'next/head'
|
import Head from 'next/head'
|
||||||
|
|
||||||
import { App } from '../src/components/App'
|
import { App } from '../src/components/App'
|
||||||
import { Page } from '../src/components/Page'
|
import { Page } from '../src/components/Page'
|
||||||
import menuModel from '../src/models/menu'
|
import menuModel from '../src/models/menu'
|
||||||
@@ -13,19 +14,18 @@ const Index = (props) => (
|
|||||||
menu={buildMenu(props.pageUrl, menuModel)}
|
menu={buildMenu(props.pageUrl, menuModel)}
|
||||||
showAuthor={true}
|
showAuthor={true}
|
||||||
menuPadding={true}
|
menuPadding={true}
|
||||||
|
layout={'thin'}
|
||||||
>
|
>
|
||||||
<Head>
|
<Head>
|
||||||
<title>{props.title}</title>
|
<title>{props.title}</title>
|
||||||
<Meta meta={props.meta} />
|
<Meta meta={props.meta} />
|
||||||
</Head>
|
</Head>
|
||||||
|
|
||||||
<div className={'content content_thin'}>
|
|
||||||
<Page
|
<Page
|
||||||
showSocialShare={true}
|
showSocialShare={true}
|
||||||
>
|
>
|
||||||
{props.content}
|
{props.content}
|
||||||
</Page>
|
</Page>
|
||||||
</div>
|
|
||||||
</App>
|
</App>
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
import dynamic from 'next/dynamic'
|
import dynamic from 'next/dynamic'
|
||||||
|
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'
|
||||||
|
|
||||||
const Header = dynamic(() => import('./Header'), {
|
const Header = dynamic(() => import('./Header'), {
|
||||||
ssr: false,
|
ssr: false,
|
||||||
@@ -9,31 +12,46 @@ const Header = dynamic(() => import('./Header'), {
|
|||||||
|
|
||||||
import '../../style/style.scss'
|
import '../../style/style.scss'
|
||||||
|
|
||||||
export const App = ({ children, menu, showAuthor, menuPadding }) => (
|
export interface IAppProps {
|
||||||
|
menu: any
|
||||||
|
showAuthor: boolean
|
||||||
|
menuPadding: boolean
|
||||||
|
layout?: 'full' | 'wide' | 'thin'
|
||||||
|
}
|
||||||
|
|
||||||
|
export const App: React.FC<IAppProps> = props => {
|
||||||
|
const layout = props.layout ? props.layout : 'full'
|
||||||
|
const motionDisabled = useReducedMotion()
|
||||||
|
|
||||||
|
return (
|
||||||
<div className="body-wrapper theme-default">
|
<div className="body-wrapper theme-default">
|
||||||
<header>
|
<header>
|
||||||
<div className="navigation">
|
<div className="navigation">
|
||||||
<div className="navigation__body">
|
<div className="navigation__body">
|
||||||
<Header
|
<Header
|
||||||
menuItems={menu.items}
|
menuItems={props.menu.items}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<main className="body-wrapper__content">
|
<main className="body-wrapper__content">
|
||||||
<section className={`content content_full ${menuPadding ? 'content--padding-top--menu' : ''}`}>
|
<section className={cx('content', `content_${layout}`, {
|
||||||
{children}
|
'content--padding-top--menu': props.menuPadding,
|
||||||
|
'reduced-motion': motionDisabled,
|
||||||
|
})}>
|
||||||
|
{props.children}
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<Comments />
|
<Comments />
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
<Footer
|
<Footer
|
||||||
showAuthor={showAuthor}
|
showAuthor={props.showAuthor}
|
||||||
address=" г. Шлиссельбург ул. 18 января д. 3"
|
address=" г. Шлиссельбург ул. 18 января д. 3"
|
||||||
telephone="+7 (81362) 76-312"
|
telephone="+7 (81362) 76-312"
|
||||||
email="hudozka@gmail.com"
|
email="hudozka@gmail.com"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
}
|
||||||
@@ -40,6 +40,10 @@
|
|||||||
animation: smallSlideInFromTop 350ms ease-out;
|
animation: smallSlideInFromTop 350ms ease-out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.content.reduced-motion {
|
||||||
|
animation: none;
|
||||||
|
}
|
||||||
|
|
||||||
@media screen and (max-width: var(--mobile-width)) {
|
@media screen and (max-width: var(--mobile-width)) {
|
||||||
--content-mobile: 95%;
|
--content-mobile: 95%;
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user