Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ajout router #9

Merged
merged 15 commits into from
Feb 5, 2025
52 changes: 31 additions & 21 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 @@ -29,6 +29,7 @@
"husky": "^8.0.3",
"prettier": "^3.4.2",
"prettier-plugin-tailwindcss": "^0.5.5",
"react-router-dom": "^7.1.5",
"sass": "^1.83.4",
"vite": "^4.4.9"
}
Expand Down
20 changes: 15 additions & 5 deletions src/app.jsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
import { Route, Routes } from 'react-router-dom';

import './app.scss';
import HomePage from './pages/home-page';
import Favorites from './components/favorites';
import Footer from './components/footer';
import Home from './components/home';
import NavBar from './components/navbar';
import ProfilePage from './pages/profile-page';

function App() {
return (
<>
<HomePage />
<ProfilePage />
</>
<Routes>
<Route element={<NavBar />}>
<Route element={<Footer />}>
<Route path='/' element={<Home />} />
<Route path='/favorites' element={<Favorites />} />
<Route path='/profilePage' element={<ProfilePage />} />
</Route>
</Route>
</Routes>
);
}

Expand Down
52 changes: 30 additions & 22 deletions src/components/footer.jsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,39 @@
import { Outlet } from 'react-router-dom';

import '../style/footer.scss';
import Socials from './socials.jsx';

function Footer() {
return (
<div className='footer'>
<img src='/pictures/marvel-logo.png' alt='marvel-logo' />
<div className='footer-nav'>
<div>
<a href='https://marvelofficial.com/shop/?srsltid=AfmBOorVehT8ELdv9CSRuSbn2YBFn_1tngBPVsIlMT4j70lF8KhpRGsb'>
Shops
</a>
<a href='https://www.disneyplus.com/brand/marvel?cid=DTCI-Synergy-Marvel-Site-Acquisition-Library-US-Marvel-NA-EN-NavFooter-Marvel_DisneyPlus_NavFooter_Evergreen-NA'>
Disney+
</a>
</div>
<>
<Outlet />

<footer>
<div className='footer'>
<img src='/marvel-logo.png' alt='marvel-logo' />
<div className='footer-nav'>
<div>
<a href='https://marvelofficial.com/shop/?srsltid=AfmBOorVehT8ELdv9CSRuSbn2YBFn_1tngBPVsIlMT4j70lF8KhpRGsb'>
Shops
</a>
<a href='https://www.disneyplus.com/brand/marvel?cid=DTCI-Synergy-Marvel-Site-Acquisition-Library-US-Marvel-NA-EN-NavFooter-Marvel_DisneyPlus_NavFooter_Evergreen-NA'>
Disney+
</a>
</div>

<div>
<a href='https://marvelstory.fr/'>Blog</a>
<a href='https://www.marvelhq.com/'>Marvel.com</a>
</div>
<div>
<a href='https://www.marvel.com/corporate/advertising'>Advertising</a>
<a href='https://help.marvel.com/'>Help/Faq</a>
</div>
</div>
<Socials />
</div>
<div>
<a href='https://marvelstory.fr/'>Blog</a>
<a href='https://www.marvelhq.com/'>Marvel.com</a>
</div>
<div>
<a href='https://www.marvel.com/corporate/advertising'>Advertising</a>
<a href='https://help.marvel.com/'>Help/Faq</a>
</div>
</div>
<Socials />
</div>{' '}
</footer>
</>
);
}

Expand Down
5 changes: 5 additions & 0 deletions src/components/home.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const Home = () => {
return <h1>Home</h1>;
};

export default Home;
44 changes: 28 additions & 16 deletions src/components/navbar.jsx
Original file line number Diff line number Diff line change
@@ -1,28 +1,40 @@
import { useState } from 'react';
import { Link, Outlet } from 'react-router-dom';

import '../style/navbar.scss';

function Navbar() {
const [input, setInput] = useState('');

return (
<nav>
<ul>
<li>
{' '}
<img src='/pictures/home.png' alt='' /> Home
</li>
<>
<header>
<nav>
<ul>
<li>
{' '}
<Link to='/' className='myLink'>
<img src='/home.png' alt='' /> Home
</Link>
</li>

<li className='input-wrapper'>
<img src='/pictures/search.png' alt='' />
<input type='text' placeholder='Search' value={input} onChange={(e) => setInput(e.target.value)} />
</li>
<li>
<img src='/pictures/heart.png' alt='' />
Favorites
</li>
</ul>
</nav>
<li className='input-wrapper'>
<img src='/search.png' alt='' />
<input type='text' placeholder='Search' value={input} onChange={(e) => setInput(e.target.value)} />
</li>
<li>
<Link to='/favorites' className='myLink'>
{' '}
<img src='/heart.png' alt='' />
Favorites
</Link>
</li>
</ul>
</nav>
</header>

<Outlet />
</>
);
}

Expand Down
7 changes: 5 additions & 2 deletions src/main.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import React from 'react';
import ReactDOM from 'react-dom/client';
import { BrowserRouter } from 'react-router-dom';

import App from './app';
import App from './app.jsx';

ReactDOM.createRoot(document.getElementById('root')).render(
<React.StrictMode>
<App />
<BrowserRouter>
<App />
</BrowserRouter>
</React.StrictMode>,
);
3 changes: 3 additions & 0 deletions src/style/footer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
justify-content: space-between;
width: 100%;
height: 100%;

background-color: #670208;
margin-top: 30px;
}

.footer > img {
Expand Down
12 changes: 10 additions & 2 deletions src/style/navbar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,25 @@ nav {
padding: 20px;
gap: 190px;

.myLink {
color: white;
text-decoration: none;
display: flex;
}
img {
width: 23px;
height: 23px;
margin-bottom: 04px;
margin-bottom: 05px;
padding-right: 1px;
}

li {
display: flex;
align-items: center;
font-size: 20px;

/* padding:20 ; */
font-size: 22px;

color: white;
font-family: 'Aclonica', sans-serif;
margin-left: 20px;
Expand Down