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 cx from 'classnames'
|
||||
import { Footer } from '../Footer'
|
||||
import Comments from '../Comments'
|
||||
import { useReducedMotion } from 'src/hooks/useReducedMotion'
|
||||
import { Wrapper } from '../Wrapper'
|
||||
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), {
|
||||
ssr: false,
|
||||
})
|
||||
@@ -20,31 +23,30 @@ export const App: React.FC<IAppProps> = props => {
|
||||
const motionDisabled = useReducedMotion()
|
||||
|
||||
return (
|
||||
<Wrapper
|
||||
header={(
|
||||
<Header>
|
||||
<Navigation
|
||||
items={props.menu.items}
|
||||
<ConfigContext.Provider value={config}>
|
||||
<Wrapper
|
||||
header={(
|
||||
<Header>
|
||||
<Navigation
|
||||
items={props.menu.items}
|
||||
/>
|
||||
</Header>
|
||||
)}
|
||||
footer={(
|
||||
<AppFooter
|
||||
showAuthor={props.showAuthor}
|
||||
/>
|
||||
</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>
|
||||
)}
|
||||
>
|
||||
<section className={cx('content', `content_${props.layout}`, {
|
||||
'content--padding-top--menu': props.menuPadding,
|
||||
'reduced-motion': motionDisabled,
|
||||
})}>
|
||||
{props.children}
|
||||
</section>
|
||||
|
||||
<Comments />
|
||||
</Wrapper>
|
||||
<Comments />
|
||||
</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