api call ssr landing + latest product + ...
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import Footer from '@/share/Footer'
|
||||
import Header from '@/share/Header'
|
||||
import { FC } from 'react'
|
||||
|
||||
interface LayoutProps {
|
||||
children: React.ReactNode
|
||||
}
|
||||
|
||||
const Layout: FC<LayoutProps> = ({ children }) => {
|
||||
return (
|
||||
<div className="min-h-screen flex flex-col">
|
||||
<Header />
|
||||
<main className="flex-1">
|
||||
{children}
|
||||
</main>
|
||||
<Footer />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default Layout
|
||||
@@ -1,39 +0,0 @@
|
||||
|
||||
import Footer from '@/share/Footer'
|
||||
import Header from '@/share/Header'
|
||||
import { FC, ComponentType } from 'react'
|
||||
// import Header from '@/share/Header'
|
||||
|
||||
interface LayoutProps {
|
||||
children: React.ReactNode
|
||||
}
|
||||
|
||||
const Layout: FC<LayoutProps> = ({ children }) => {
|
||||
return (
|
||||
<div className="min-h-screen flex flex-col">
|
||||
<Header />
|
||||
<main className="flex-1">
|
||||
{children}
|
||||
</main>
|
||||
<Footer />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
// HOC function
|
||||
function withLayout<P extends object>(WrappedComponent: ComponentType<P>) {
|
||||
const WithLayoutComponent: FC<P> = (props) => {
|
||||
return (
|
||||
<Layout>
|
||||
<WrappedComponent {...props} />
|
||||
</Layout>
|
||||
)
|
||||
}
|
||||
|
||||
WithLayoutComponent.displayName = `withLayout(${WrappedComponent.displayName || WrappedComponent.name})`
|
||||
|
||||
return WithLayoutComponent
|
||||
}
|
||||
|
||||
export default withLayout
|
||||
export { Layout }
|
||||
Reference in New Issue
Block a user