This commit is contained in:
Tomas Dvorak
2025-10-23 22:26:50 +02:00
parent 63700eedb2
commit 70ea0c3c91
75 changed files with 3337 additions and 1160 deletions
+39 -6
View File
@@ -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"