move footer props to config
This commit is contained in:
1 parent
4f0d61735f
commit
c0dd5cf6ae
4 files changed
+36
-5
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,6 +23,7 @@ export const App: React.FC<IAppProps> = props => {
|
|||||||
const motionDisabled = useReducedMotion()
|
const motionDisabled = useReducedMotion()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<ConfigContext.Provider value={config}>
|
||||||
<Wrapper
|
<Wrapper
|
||||||
header={(
|
header={(
|
||||||
<Header>
|
<Header>
|
||||||
@@ -29,11 +33,8 @@ export const App: React.FC<IAppProps> = props => {
|
|||||||
</Header>
|
</Header>
|
||||||
)}
|
)}
|
||||||
footer={(
|
footer={(
|
||||||
<Footer
|
<AppFooter
|
||||||
showAuthor={props.showAuthor}
|
showAuthor={props.showAuthor}
|
||||||
address=" г. Шлиссельбург ул. 18 января д. 3"
|
|
||||||
telephone="+7 (81362) 76-312"
|
|
||||||
email="hudozka@gmail.com"
|
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
@@ -46,5 +47,6 @@ export const App: React.FC<IAppProps> = props => {
|
|||||||
|
|
||||||
<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