Skip to content

Commit

Permalink
add routes
Browse files Browse the repository at this point in the history
  • Loading branch information
Victoria-Fedkova committed Sep 17, 2023
1 parent cf5a525 commit 834f547
Show file tree
Hide file tree
Showing 14 changed files with 1,097 additions and 6 deletions.
32 changes: 30 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"modern-normalize": "^2.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-helmet-async": "^1.3.0",
"react-redux": "^8.1.2",
"react-router-dom": "^6.16.0",
"redux": "^4.2.1",
Expand Down
23 changes: 19 additions & 4 deletions src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,26 @@
import { Route, Routes } from 'react-router-dom';
import { HelmetProvider } from 'react-helmet-async';
import { lazy } from 'react';

const MainPage = lazy(() => import('./pages/MainPage/MainPage'));
const FavouritePage = lazy(() => import('./pages/FavouritePage/FavouritePage'));
const SerchPage = lazy(() => import('./pages/SerchPage/SerchPage'));
const NotFound = lazy(() => import('./pages/NotFound/NotFound'));
import './App.css';
import { SharedLayout } from './components/SharedLayout/SharedLayout';

function App() {
return (
<>
<h1>hello hello</h1>
<h2>some text</h2>
</>
<HelmetProvider>
<Routes>
<Route path="/" element={<SharedLayout />}>
<Route index element={<MainPage />} />
<Route path="serch/*" element={<SerchPage />} />
<Route path="favourite" element={<FavouritePage />} />
<Route path="*" element={<NotFound />} />
</Route>
</Routes>
</HelmetProvider>
);
}

Expand Down
File renamed without changes.
7 changes: 7 additions & 0 deletions src/components/Loader/Loader.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export const Loader = () => {
return (
<>
<p>...loading</p>
</>
);
};
File renamed without changes.
File renamed without changes.
17 changes: 17 additions & 0 deletions src/components/SharedLayout/SharedLayout.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Outlet } from 'react-router-dom';
import { Suspense } from 'react';
// import { Loader } from '../Loader/Loader';

export const SharedLayout = () => {
return (
<div>
<div>page header</div>
<main>
<Suspense fallback={<div>Loading...</div>}>
<Outlet />
</Suspense>
</main>
<div>page footer</div>
</div>
);
};
19 changes: 19 additions & 0 deletions src/components/SharedLayout/SharedLayout.styled.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import styled from 'styled-components';

export const MainLayoutContainer = styled.div`
display: flex;
/* min-height: 100vh; */
`;

export const Wrapper = styled.div`
display: flex;
flex-direction: column;
width: 100%;
height: 100%;
@media screen and (min-width: 1440px) {
width: calc(100% - 289px);
}
`;
7 changes: 7 additions & 0 deletions src/pages/FavouritePage/FavouritePage.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default function FavouritePage() {
return (
<>
<h1>FavouritePage</h1>
</>
);
}
7 changes: 7 additions & 0 deletions src/pages/MainPage/MainPage.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default function MainPage() {
return (
<>
<h1>Main page</h1>
</>
);
}
7 changes: 7 additions & 0 deletions src/pages/NotFound/NotFound.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default function NotFound() {
return (
<>
<h1>NotFound</h1>
</>
);
}
7 changes: 7 additions & 0 deletions src/pages/SerchPage/SerchPage.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default function SerchPage() {
return (
<>
<h1>SerchPage</h1>
</>
);
}
Loading

0 comments on commit 834f547

Please sign in to comment.