mirror of
https://github.com/Dvorinka/MyClubServer.git
synced 2026-06-04 18:52:56 +00:00
dev day #69
This commit is contained in:
@@ -3,13 +3,18 @@ import { ReactNode, useEffect, useState } from 'react';
|
||||
import { FiChevronUp } from 'react-icons/fi';
|
||||
import Navbar from '../Navbar';
|
||||
import Footer from './Footer';
|
||||
import { useAllPageElementConfigs } from '../../hooks/usePageElementConfig';
|
||||
import SpartaNavbar from '../elements/SpartaNavbar';
|
||||
|
||||
interface MainLayoutProps {
|
||||
children: ReactNode;
|
||||
headerInsideContainer?: boolean;
|
||||
}
|
||||
|
||||
export const MainLayout: React.FC<MainLayoutProps> = ({ children }) => {
|
||||
export const MainLayout: React.FC<MainLayoutProps> = ({ children, headerInsideContainer = false }) => {
|
||||
const [showTop, setShowTop] = useState(false);
|
||||
const { getStyles, getVariant } = useAllPageElementConfigs('homepage');
|
||||
const headerVariant = getVariant('header', 'unified');
|
||||
|
||||
useEffect(() => {
|
||||
const onScroll = () => {
|
||||
@@ -33,11 +38,39 @@ export const MainLayout: React.FC<MainLayoutProps> = ({ children }) => {
|
||||
return (
|
||||
<Box minH="100vh" bg="bg.app" overflowX="hidden">
|
||||
<Box id="top" position="absolute" top={0} left={0} />
|
||||
<Navbar />
|
||||
<Container maxW="container.xl" py={8}>
|
||||
{children}
|
||||
</Container>
|
||||
<Footer />
|
||||
{headerInsideContainer ? (
|
||||
<>
|
||||
<Container maxW="container.xl" py={8}>
|
||||
<Box as="header" data-element="header" style={{ ...getStyles('header') }}>
|
||||
{headerVariant === 'sparta_navbar' ? (
|
||||
<SpartaNavbar />
|
||||
) : (
|
||||
<Navbar fullWidth={headerVariant === 'fullwidth'} />
|
||||
)}
|
||||
</Box>
|
||||
{children}
|
||||
</Container>
|
||||
<Box as="footer" data-element="footer" style={{ ...getStyles('footer') }}>
|
||||
<Footer />
|
||||
</Box>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Box as="header" data-element="header" style={{ ...getStyles('header') }}>
|
||||
{headerVariant === 'sparta_navbar' ? (
|
||||
<SpartaNavbar />
|
||||
) : (
|
||||
<Navbar fullWidth={headerVariant === 'fullwidth'} />
|
||||
)}
|
||||
</Box>
|
||||
<Container maxW="container.xl" py={8}>
|
||||
{children}
|
||||
</Container>
|
||||
<Box as="footer" data-element="footer" style={{ ...getStyles('footer') }}>
|
||||
<Footer />
|
||||
</Box>
|
||||
</>
|
||||
)}
|
||||
{showTop && (
|
||||
<IconButton
|
||||
aria-label="Zpět nahoru"
|
||||
|
||||
Reference in New Issue
Block a user