Exp8 CODES
Exp8 CODES
(A3_16014123058_Aryan Pundle)
App.css
.App {
text-align: center;
}
.App-logo {
height:
40vmin;
pointer-events: none;
}
.App-header {
background-color:
#282c34; min-height:
100vh;
display: flex;
flex-direction:
column; align-items:
center; justify-content:
center;
font-size: calc(10px + 2vmin);
color: white;
}
.App-link {
color: #61dafb;
}
@keyframes App-logo-spin
{ from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
/* src/App.css */
.main-content
{ flex: 1;
padding-bottom: 60px; /* Add padding to avoid overlapping with the footer
*/ overflow-y: auto;
max-height: calc(100vh - 80px); /* Adjust height to account for header and footer */
}
App.js
// src/App.js
import React, { useState } from 'react';
import { BrowserRouter as Router, Route, Routes } from 'react-router-dom';
import Navbar from './components/Navbar';
import Footer from
'./components/Footer'; import Home from
'./pages/Home'; import Products from
'./pages/Products';
import ProductDetails from './pages/ProductDetails';
import Cart from './pages/Cart';
import Contact from './pages/Contact';
import './App.css';
function App() {
const [cartItems, setCartItems] = useState([]);
return (
<Router>
<Navbar />
<main className="main-content">
<Routes>
<Route path="/" element={<Home />} />
<Route path="/products" element={<Products onAddToCart={addToCart} />} />
<Route path="/product/:id" element={<ProductDetails />} />
<Route path="/cart" element={<Cart cartItems={cartItems} onRemove={removeFromCart} />} />
<Route path="/contact" element={<Contact />} />
</Routes>
</main>
<Footer />
</Router>
);
}
Footer.css
/* src/components/Footer.css */
.footer {
text-align: center;
padding: 4px;
background-color: #333333;
color: #fff;
position: fixed;
width: 100%;
bottom: 0;
}
index.css
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
monospace;
}
index.js
import React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';