import 'bootstrap/dist/css/bootstrap.min.css';
import React from 'react';
import ReactDOM from 'react-dom/client';
import { RouterProvider, createBrowserRouter } from 'react-router-dom';
import App from './App.jsx';
import './index.css';
import ErrorPage from './pages/ErrorPage.jsx';
import Page1 from './pages/Page1.jsx';
import Page2 from './pages/Page2.jsx';
import Page3 from './pages/Page3.jsx';
import Page4 from './pages/Page4.jsx';
import Page5 from './pages/Page5.jsx';
import Admin from './pages/Admin.jsx';
import Reduse from './pages/Reduse.jsx';

const routes = [
  {
    index: true,
    path: '/',
    element: <Page1 />,
    title: 'Новости',
  },
  {
    path: '/page2',
    element: <Page2 />,
    title: 'Об университете',
  },
  {
    path: '/page3',
    element: <Page3 />,
    title: 'Абитуриенту',
  },
  {
    path: '/page4',
    element: <Page4 />,
    title: 'Вход',
  },
  {
    path: '/page5',
    element: <Page5 />,
    title: 'Контакты',
  },
  {
    path: '/admin',
    element: <Admin />,
  },
  {
    path: '/reduse',
    element: <Reduse />,
  },
];

const router = createBrowserRouter([
  {
    path: '/',
    element: <App routes={routes} />,
    children: routes,
    errorElement: <ErrorPage />,
  },
]);

ReactDOM.createRoot(document.getElementById('root')).render(
  <React.StrictMode>
    <RouterProvider router={router} />
  </React.StrictMode>,
);
