diff --git a/front/src/App.js b/front/src/App.js new file mode 100644 index 0000000..173405f --- /dev/null +++ b/front/src/App.js @@ -0,0 +1,45 @@ +import { useRoutes, Outlet, BrowserRouter } from 'react-router-dom' +import Films from './pages/Films' +import FilmPage from './pages/FilmPage' +import Header from './pages/components/Header' +import Footer from './pages/components/Footer' +import SearchSame from './pages/SearchSame' +import Registration from './pages/Registration' +import Sessions from './pages/Sessions' +import Orders from './pages/Orders' + +function Router(props) { + return useRoutes(props.rootRoute); +} + +export default function App() { + const routes = [ + { index: true, element: }, + { path: '/films', element: , label: 'Главная' }, + { path: '/registration', element: , label: 'Регистрация' }, + { path: '/sessions', element: , label: 'Сеансы' }, + { path: '/orders', element: , label: 'Заказы' }, + { path: '/films/:id', element: }, + { path: '/search-same/:request', element: } + ]; + const links = routes.filter(route => route.hasOwnProperty('label')); + const rootRoute = [ + { path: '/', element: render(links), children: routes } + ]; + + function render(links) { + return ( + <> +
+ +