import { Head } from '@inertiajs/inertia-react';
import React, { useState } from 'react'
import Footer from '../components/Footer';
import Header from '../components/Header';
import FlashMessage from '../components/FlashMessage';
import Cartbar from '../components/Cartbar';
import Loader from '../components/Loader';

export default function FrontLayout({ children, title }) {
  const [status, setStatus] = useState(false);
  
  function onSetSidebarOpen() {
    setStatus(false);
  }

  return (
    <>
      <Head title={title} />
      <Cartbar status={status} onSetSidebarOpen={onSetSidebarOpen} />
      <Header setStatus={setStatus} />
      <FlashMessage />
        <main>
          {children}
        </main>
      <Footer />
    </>
  )
}