move footer props to config
This commit is contained in:
1 parent
4f0d61735f
commit
c0dd5cf6ae
4 files changed
+56
-25
No files matched your search
@@ -0,0 +1,20 @@
|
|||||||
|
import { Footer } from '../Footer'
|
||||||
|
import { useContext } from 'react'
|
||||||
|
import { ConfigContext } from 'src/context/ConfigContext'
|
||||||
|
|
||||||
|
export type AppFooterProps = {
|
||||||
|
showAuthor: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
export const AppFooter: React.FC<AppFooterProps> = props => {
|
||||||
|
const config = useContext(ConfigContext)
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Footer
|
||||||
|
showAuthor={props.showAuthor}
|
||||||
|
address={config.address}
|
||||||
|
telephone={config.telephone}
|
||||||
|
email={config.email}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -1,10 +1,13 @@
|
|||||||
import dynamic from 'next/dynamic'
|
import dynamic from 'next/dynamic'
|
||||||
import cx from 'classnames'
|
import cx from 'classnames'
|
||||||
import { Footer } from '../Footer'
|
|
||||||
import Comments from '../Comments'
|
import Comments from '../Comments'
|
||||||
import { useReducedMotion } from 'src/hooks/useReducedMotion'
|
import { useReducedMotion } from 'src/hooks/useReducedMotion'
|
||||||
import { Wrapper } from '../Wrapper'
|
import { Wrapper } from '../Wrapper'
|
||||||
import { Header } from './Header'
|
import { Header } from './Header'
|
||||||
|
import { ConfigContext } from 'src/context/ConfigContext'
|
||||||
|
import config from 'src/config'
|
||||||
|
import { AppFooter } from './AppFooter'
|
||||||
|
|
||||||
const Navigation = dynamic(() => import('../Navigation').then(mod => mod.Navigation), {
|
const Navigation = dynamic(() => import('../Navigation').then(mod => mod.Navigation), {
|
||||||
ssr: false,
|
ssr: false,
|
||||||
})
|
})
|
||||||
@@ -20,31 +23,30 @@ export const App: React.FC<IAppProps> = props => {
|
|||||||
const motionDisabled = useReducedMotion()
|
const motionDisabled = useReducedMotion()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Wrapper
|
<ConfigContext.Provider value={config}>
|
||||||
header={(
|
<Wrapper
|
||||||
<Header>
|
header={(
|
||||||
<Navigation
|
<Header>
|
||||||
items={props.menu.items}
|
<Navigation
|
||||||
|
items={props.menu.items}
|
||||||
|
/>
|
||||||
|
</Header>
|
||||||
|
)}
|
||||||
|
footer={(
|
||||||
|
<AppFooter
|
||||||
|
showAuthor={props.showAuthor}
|
||||||
/>
|
/>
|
||||||
</Header>
|
)}
|
||||||
)}
|
>
|
||||||
footer={(
|
<section className={cx('content', `content_${props.layout}`, {
|
||||||
<Footer
|
'content--padding-top--menu': props.menuPadding,
|
||||||
showAuthor={props.showAuthor}
|
'reduced-motion': motionDisabled,
|
||||||
address=" г. Шлиссельбург ул. 18 января д. 3"
|
})}>
|
||||||
telephone="+7 (81362) 76-312"
|
{props.children}
|
||||||
email="hudozka@gmail.com"
|
</section>
|
||||||
/>
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
<section className={cx('content', `content_${props.layout}`, {
|
|
||||||
'content--padding-top--menu': props.menuPadding,
|
|
||||||
'reduced-motion': motionDisabled,
|
|
||||||
})}>
|
|
||||||
{props.children}
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<Comments />
|
<Comments />
|
||||||
</Wrapper>
|
</Wrapper>
|
||||||
|
</ConfigContext.Provider>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
export default {
|
||||||
|
address: "г. Шлиссельбург ул. 18 января д. 3",
|
||||||
|
telephone: "+7 (81362) 76-312",
|
||||||
|
email: "hudozka@gmail.com",
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
import { createContext } from 'react'
|
||||||
|
import config from 'src/config'
|
||||||
|
|
||||||
|
export const ConfigContext = createContext(config)
|
||||||
Reference in new issue
Block a user