-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added HomePage, Header, Footer and Darkmode
- Loading branch information
SurajOberoi15
committed
Feb 13, 2024
1 parent
f03d941
commit a2b8d34
Showing
26 changed files
with
394 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,14 @@ | ||
import './App.css'; | ||
import { BrowserRouter as Router } from 'react-router-dom'; // Import BrowserRouter | ||
|
||
import { ProductsList } from './pages/Products/ProductsList'; | ||
import {AllRoutes} from "./routes/AllRoutes"; | ||
import { AllRoutes } from './routes/AllRoutes'; | ||
import { Footer, Header } from './components'; | ||
|
||
function App() { | ||
return ( | ||
<Router> | ||
<div className='App'> | ||
<AllRoutes/> | ||
</div> | ||
</Router> | ||
<div className="App dark:bg-dark"> | ||
<Header /> | ||
<AllRoutes /> | ||
<Footer /> | ||
</div> | ||
); | ||
} | ||
|
||
export default App; | ||
export default App; |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,48 @@ | ||
import React from 'react'; | ||
import carPicture from "../../assets/images/10001.avif" | ||
|
||
|
||
export const ProductCard = ({product}) => { | ||
const {carId, brand, model, year, color, mileage, price, quantity, tax, poster, in_stock} = product; | ||
|
||
return ( | ||
<div className="m-3 max-w-sm bg-white rounded-lg border border-gray-200 shadow-md dark:bg-gray-800 dark:border-gray-700"> | ||
<a href="/" className="relative" > | ||
{/* <span className="absolute top-4 left-2 px-2 bg-orange-500 bg-opacity-90 text-white rounded">Best Seller</span> */} | ||
<img className="rounded-t-lg w-full h-64" src={poster} alt="" /> | ||
export const ProductCard = ({ product }) => { | ||
if (!product) { | ||
return null; // Or handle the case where product is undefined | ||
} | ||
const { carId, brand, model, year, color, mileage, price, quantity, tax, poster, in_stock } = product; | ||
|
||
return ( | ||
<div className="m-3 max-w-sm bg-white rounded-lg border border-gray-200 shadow-md dark:bg-gray-800 dark:border-gray-700"> | ||
<a href="/" className="relative"> | ||
{/* <span className="absolute top-4 left-2 px-2 bg-orange-500 bg-opacity-90 text-white rounded">Best Seller</span> */} | ||
<img className="rounded-t-lg w-full h-64" src={poster} alt="" /> | ||
</a> | ||
<div className="p-5"> | ||
<a href="/"> | ||
<h5 className="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white">{brand} {model}</h5> | ||
</a> | ||
<p className="mb-3 font-normal text-gray-700 dark:text-gray-400">{color}</p> | ||
|
||
<p className="mb-3 font-normal text-black dark:text-gray-400"> | ||
<span>mileage: </span><span>{mileage}</span> | ||
</p> | ||
<p className="mb-3 font-normal text-black dark:text-gray-400"> | ||
<span>quantity: </span><span>{quantity}</span> | ||
</p> | ||
<p className="mb-3 font-normal text-black dark:text-gray-400"> | ||
<span>tax: </span><span>{tax}</span> | ||
</p> | ||
|
||
<div className="flex items-center my-2"> | ||
<i className="text-lg bi bi-star-fill text-yellow-500 mr-1">{in_stock}</i> | ||
<i className="text-lg bi bi-star-fill text-yellow-500 mr-1"></i> | ||
<i className="text-lg bi bi-star-fill text-yellow-500 mr-1"></i> | ||
<i className="text-lg bi bi-star-fill text-yellow-500 mr-1"></i> | ||
<i className="text-lg bi bi-star-fill text-yellow-500 mr-1"></i> | ||
</div> | ||
|
||
<p className="flex justify-between items-center"> | ||
<span className="text-2xl dark:text-gray-200"> | ||
<span>INR </span><span>{price}</span> | ||
</span> | ||
{/* <button className="inline-flex items-center py-2 px-3 text-sm font-medium text-center text-white bg-blue-700 rounded-lg hover:bg-blue-800"/> */} | ||
<button className='inline-flex items-center py-2 px-3 text-sm font-medium text-center text-white bg-blue-700 rounded-lg hover:bg-blue-800'>Add To Cart +</button> | ||
</p> | ||
<a href="/"> | ||
<h5 className="mb-2 text-2xl font-bold tracking-tight text-gray-900 dark:text-white">{brand} {model}</h5> | ||
</a> | ||
<p className="mb-3 font-normal text-gray-700 dark:text-gray-400">{color}</p> | ||
|
||
<p className="mb-3 font-normal text-black dark:text-gray-400"> | ||
<span>Year: </span><span>{year}</span> | ||
</p> | ||
<p className="mb-3 font-normal text-black dark:text-gray-400"> | ||
<span>Mileage: </span><span>{mileage}</span> | ||
</p> | ||
<p className="mb-3 font-normal text-black dark:text-gray-400"> | ||
<span>Quantity: </span><span>{quantity}</span> | ||
</p> | ||
<p className="mb-3 font-normal text-black dark:text-gray-400"> | ||
<span>Tax: </span><span>{tax}</span> | ||
</p> | ||
|
||
<div className="flex items-center my-2"> | ||
<i className="text-lg bi bi-star-fill text-yellow-500 mr-1">{in_stock}</i> | ||
</div> | ||
|
||
<p className="flex justify-between items-center"> | ||
<span className="text-2xl dark:text-gray-200"> | ||
<span>INR </span><span>{price}</span> | ||
</span> | ||
<button className='inline-flex items-center py-2 px-3 text-sm font-medium text-center text-white bg-blue-700 rounded-lg hover:bg-blue-800'>Add To Cart +</button> | ||
</p> | ||
</div> | ||
</div> | ||
) | ||
} | ||
</div> | ||
); | ||
}; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { useEffect, useState } from "react"; | ||
import { Link } from "react-router-dom"; | ||
import Logo from "../../assets/logo.png"; | ||
|
||
export const Header = () => { | ||
const [darkMode, setDarkMode] = useState(JSON.parse(localStorage.getItem("darkMode")) || false); | ||
|
||
useEffect(() => { | ||
localStorage.setItem("darkMode", JSON.stringify(darkMode)); | ||
|
||
if(darkMode){ | ||
document.documentElement.classList.add("dark"); | ||
} else { | ||
document.documentElement.classList.remove("dark"); | ||
} | ||
}, [darkMode]); | ||
|
||
return ( | ||
<header> | ||
<nav className="bg-white dark:bg-gray-900"> | ||
<div className="border-b border-slate-200 dark:border-b-0 flex flex-wrap justify-between items-center mx-auto max-w-screen-xl px-4 md:px-6 py-3"> | ||
<Link to="/" className="flex items-center"> | ||
<img src={Logo} className="mr-3 h-10" alt="CodeBook Logo" /> | ||
<span className="self-center text-2xl font-semibold whitespace-nowrap dark:text-white">NashtechAutoMarket</span> | ||
</Link> | ||
<div className="flex items-center relative"> | ||
<span onClick={() => setDarkMode(!darkMode)} className="cursor-pointer text-xl text-gray-700 dark:text-white mr-5 bi bi-gear-wide-connected"></span> | ||
<span className="cursor-pointer text-xl text-gray-700 dark:text-white mr-5 bi bi-search"></span> | ||
<Link to="/cart" className="text-gray-700 dark:text-white mr-5"> | ||
<span className="text-2xl bi bi-cart-fill relative"> | ||
<span className="text-white text-sm absolute -top-1 left-2.5 bg-rose-500 px-1 rounded-full ">0</span> | ||
</span> | ||
</Link> | ||
<span className="bi bi-person-circle cursor-pointer text-2xl text-gray-700 dark:text-white"></span> | ||
</div> | ||
</div> | ||
</nav> | ||
</header> | ||
) | ||
} |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export { Header } from "./Layout/Header" | ||
export { Footer } from "./Layout/Footer" | ||
export { ProductCard } from "./Elements/ProductCard" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,16 @@ | ||
@tailwind base; | ||
@tailwind components; | ||
@tailwind utilities; | ||
@import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap'); | ||
@import url("https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css"); | ||
|
||
* { | ||
font-family: 'Roboto', sans-serif; | ||
} | ||
|
||
main { | ||
min-height: 90vh; | ||
max-width: 1280px; | ||
margin: auto; | ||
padding: 15px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom/client'; | ||
import { BrowserRouter as Router } from 'react-router-dom'; | ||
import './index.css'; | ||
import App from './App'; | ||
|
||
const root = ReactDOM.createRoot(document.getElementById('root')); | ||
root.render( | ||
<React.StrictMode> | ||
<App /> | ||
<Router> | ||
<App /> | ||
</Router> | ||
</React.StrictMode> | ||
); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { useState } from "react"; | ||
|
||
export const Accordion = ({faq}) => { | ||
const {question, answer} = faq; | ||
const [show, setShow] = useState(false); | ||
|
||
return ( | ||
<div> | ||
<h2 id="accordion-flush-heading-1"> | ||
<button onClick={() => setShow(!show)} type="button" className="text-lg flex items-center justify-between w-full py-5 font-medium text-left text-gray-500 border-b border-gray-200 dark:border-gray-700 dark:text-gray-400" data-accordion-target="#accordion-flush-body-1" aria-expanded="true" aria-controls="accordion-flush-body-1"> | ||
<span className="text-xl text-slate-900 dark:text-white">{question}</span> | ||
{ !show && <svg data-accordion-icon className="w-6 h-6 shrink-0" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fillRule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clipRule="evenodd"></path></svg> } | ||
{ show && <svg data-accordion-icon className="rotate-180 w-6 h-6 shrink-0" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fillRule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clipRule="evenodd"></path></svg> } | ||
</button> | ||
</h2> | ||
{ show && ( | ||
<div id="accordion-flush-body-1" className="" aria-labelledby="accordion-flush-heading-1"> | ||
<div className="py-5 border-b border-gray-200 dark:border-gray-700"> | ||
<p className="text-lg mb-2 text-gray-500 dark:text-gray-400">{answer}</p> | ||
</div> | ||
</div> | ||
) } | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { Accordion } from "./Accordion"; | ||
|
||
export const Faq = () => { | ||
const faqs = [ | ||
{ | ||
"id": 1, | ||
"question": "Why should I use NashtechAutoMarket?", | ||
"answer": "Lorem ipsum, dolor sit amet consectetur adipisicing elit. Repellendus earum dicta nesciunt, nulla alias consequuntur cumque incidunt saepe mollitia esse! Magni praesentium delectus excepturi nostrum illo repellendus cum eius neque, aperiam dolores quaerat quis dolore magnam doloremque minus sint nemo qui necessitatibus at. Perspiciatis, corrupti cum labore quos odio porro!" | ||
}, | ||
{ | ||
"id": 2, | ||
"question": "Can I access my orders ?", | ||
"answer": "Lorem ipsum dolor sit amet consectetur adipisicing elit. At accusamus nobis tempore perferendis qui, quam, atque reprehenderit vero quaerat, assumenda pariatur eveniet. Maxime eaque, neque corrupti ad minus repudiandae consectetur!" | ||
}, | ||
{ | ||
"id": 3, | ||
"question": "Do you offer refunds?", | ||
"answer": "Lorem ipsum dolor sit amet, consectetur adipisicing elit. Esse iste dolor deserunt expedita quam fugit et inventore amet pariatur. Animi." | ||
}, | ||
{ | ||
"id": 4, | ||
"question": "Do you support Internation payments?", | ||
"answer": "Lorem ipsum dolor sit amet, consectetur adipisicing elit. Esse iste dolor deserunt expedita quam fugit et inventore amet pariatur. Animi." | ||
} | ||
]; | ||
|
||
return ( | ||
<section className="my-10 p-7 border rounded dark:border-slate-700 shadow-sm"> | ||
<h1 className="text-2xl text-center font-semibold dark:text-slate-100 mb-3 underline underline-offset-8">Question in mind?</h1> | ||
<div className="" id="accordion-flush" data-accordion="collapse" data-active-classes="bg-white dark:bg-gray-900 text-gray-900 dark:text-white" data-inactive-classes="text-gray-500 dark:text-gray-400"> | ||
{ faqs.map((faq) => ( | ||
<Accordion key={faq.id} faq={faq} /> | ||
)) } | ||
</div> | ||
</section> | ||
) | ||
} |
Oops, something went wrong.