Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
324 changes: 324 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,20 @@
"@mui/lab": "^5.0.0-alpha.104",
"@mui/material": "^5.10.8",
"@mui/styles": "^5.10.10",
"@reach/router": "^1.3.4",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"antd": "^4.23.4",
"bootstrap": "^5.2.3",
"material-table": "^2.0.3",
"react": "^18.2.0",
"react-bootstrap": "^2.6.0",
"react-dom": "^18.2.0",
"react-icons": "^4.4.0",
"react-router-dom": "^6.4.1",
"react-scripts": "5.0.1",
"react-use-cart": "^1.13.0",
"recharts": "^2.1.15",
"save": "^2.9.0",
"web-vitals": "^2.1.4"
Expand Down
7 changes: 7 additions & 0 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,21 @@ import Cosmetics from "./component/Cosmetics";
import Lights from "./component/Lights";
import Textiles from "./component/Textiles";
import SignIn from "./component/signIn";
import Shipping from "./views/Shipping";
import Cart from './views/Cart'
// import 'bootstrap/dist/css/bootstrap.min.css';
import { useThemeHook} from './GlobalComponents/ThemeProvider'

function App() {
return (
<>
{/* <MyShop /> */}
<BrowserRouter>
<Routes>
<Route exact path ="/cart" element={<Cart/>}/>
<Route exact path="/Shipping" element={<Shipping/>}/>
<Route exact path="/" element={<HomeLinks />}>

<Route path="electronics" element={<Electronics />} />
<Route path="decor" element={<Decorations />} />
<Route path="men" element={<Men />} />
Expand Down
28 changes: 28 additions & 0 deletions src/GlobalComponents/ThemeProvider.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import React,{ createContext,useState,useEffect, useContext} from "react";

const ThemeContext =createContext();
const ThemeProvider =(props) =>{
const [theme, setTheme]= useState(JSON.parse(localStorage.getItem('theme')) || false );
useEffect(()=>{
localStorage.setItem('theme', JSON.stringify(theme));

},[theme]);
const setThemeMode = mode => setTheme(mode);
return(
<ThemeContext.Provider value ={{ theme, setThemeMode}}>
{props.children}
</ThemeContext.Provider>

) ;


};

const useThemeHook = () =>{
const {theme}= useContext(ThemeContext);
return[theme];
}

export {
ThemeProvider, ThemeContext, useThemeHook
};
Binary file added src/assets/image/picture.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 6 additions & 3 deletions src/component/Description.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ import React, { useEffect, useState } from 'react';
import { Link, useParams } from 'react-router-dom';
import electronics from '../data/electro';
import allComponents from "../component/styles/allComponents.css";
import { Button } from "react-bootstrap";
import { useCart } from 'react-use-cart';
import Item from 'antd/lib/list/Item';


const Description = () => {
const Description = ({item}) => {
const params = useParams();
const [elect, setElect] = useState({});

Expand All @@ -15,6 +17,7 @@ const Description = () => {
}
})
}, [elect])
const { addItem }= useCart();

return (
<>
Expand All @@ -26,7 +29,7 @@ const Description = () => {
<h4>{elect.productName}</h4>
<h4>{elect.price}</h4>
<div className='link-plus'>
<i className='fas fa-cart-plus'></i>
<Button onClick={() =>addItem(elect)}> <i className='fas fa-cart-plus'></i></Button>
</div>
<button className='btn-dd'>buy now</button>

Expand Down
6 changes: 4 additions & 2 deletions src/component/ElCard.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import React from 'react';
import allComponents from "../component/styles/allComponents.css";

import { useCart } from 'react-use-cart';
import { Button } from "react-bootstrap";
const ElCard =({item}) => {
const {productName,price,image} =item;

return (
<>
<div className='cards'>
Expand All @@ -14,6 +15,7 @@ const ElCard =({item}) => {
<div>
<h5>{productName}</h5>
<h5>{price}</h5>

</div>
</div>
</div>
Expand Down
6 changes: 5 additions & 1 deletion src/component/HomeDecorDescription.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import { Link, useParams } from 'react-router-dom';
import HomeDecorList from '../data/HomeDecorList';
import allComponents from "../component/styles/allComponents.css";

import { useCart } from 'react-use-cart';
import { Button } from "react-bootstrap";


const HomeDecorDescription = () => {
const params = useParams();
Expand All @@ -15,6 +18,7 @@ const HomeDecorDescription = () => {
}
})
}, [elect])
const { addItem }= useCart();

return (
<>
Expand All @@ -26,7 +30,7 @@ const HomeDecorDescription = () => {
<h4>{elect.productName}</h4>
<h4>{elect.price}</h4>
<div className='link-plus'>
<i className='fas fa-cart-plus'></i>
<Button onClick={() =>addItem(elect)}> <i className='fas fa-cart-plus'></i></Button>
</div>
<button className='btn-dd'>buy now</button>

Expand Down
6 changes: 4 additions & 2 deletions src/component/HomeLinks.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ const HomeLinks = () => {
useEffect(()=> {
console.log(window.location.pathname);
},[])
const[cart,setcart]= useState([])
const [show,setshow] =useState(true);


const [warning, setwarning]= useState(false);
return (
<>
<Header/>
<Header />
<div className="Box-container">
<div className='links-container'>
<div>
Expand Down
5 changes: 4 additions & 1 deletion src/component/HomeProductDescription.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import React, { useEffect, useState } from 'react';
import { Link, useParams } from 'react-router-dom';
import HomeProductList from '../data/HomeProductList';
import allComponents from "../component/styles/allComponents.css";
import { Button } from "react-bootstrap";
import { useCart } from 'react-use-cart';


const HomeProductDescription = () => {
Expand All @@ -15,6 +17,7 @@ const HomeProductDescription = () => {
}
})
}, [elect])
const { addItem }= useCart();

return (
<>
Expand All @@ -26,7 +29,7 @@ const HomeProductDescription = () => {
<h4>{elect.productName}</h4>
<h4>{elect.price}</h4>
<div className='link-plus'>
<i className='fas fa-cart-plus'></i>
<Button onClick={() =>addItem(elect)}> <i className='fas fa-cart-plus'></i></Button>
</div>
<button className='btn-dd'>buy now</button>

Expand Down
7 changes: 5 additions & 2 deletions src/component/SportsDescription.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import React, { useEffect, useState } from 'react';
import { Link, useParams } from 'react-router-dom';
import sportsList from '../data/sportsList';
import allComponents from "../component/styles/allComponents.css";
import { Button } from "react-bootstrap";
import { useCart } from 'react-use-cart';



const SportsDescription = () => {
Expand All @@ -15,7 +18,7 @@ const SportsDescription = () => {
}
})
}, [elect])

const { addItem }= useCart();
return (
<>
<div className='cards-box'>
Expand All @@ -26,7 +29,7 @@ const SportsDescription = () => {
<h4>{elect.productName}</h4>
<h4>{elect.price}</h4>
<div className='link-plus'>
<i className='fas fa-cart-plus'></i>
<Button onClick={() =>addItem(elect)}> <i className='fas fa-cart-plus'></i></Button>
</div>
<button className='btn-dd'>buy now</button>
</div>
Expand Down
7 changes: 5 additions & 2 deletions src/component/ToysDescription.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import React, { useEffect, useState } from 'react';
import { Link, useParams } from 'react-router-dom';
import ToysList from '../data/ToysList';
import allComponents from "../component/styles/allComponents.css";
import { Button } from "react-bootstrap";
import { useCart } from 'react-use-cart';



const ToysDescription = () => {
Expand All @@ -15,7 +18,7 @@ const ToysDescription = () => {
}
})
}, [elect])

const { addItem }= useCart();
return (
<>
<div className='cards-box'>
Expand All @@ -26,7 +29,7 @@ const ToysDescription = () => {
<h4>{elect.productName}</h4>
<h4>{elect.price}</h4>
<div className='link-plus'>
<i className='fas fa-cart-plus'></i>
<Button onClick={() =>addItem(elect)}> <i className='fas fa-cart-plus'></i></Button>
</div>
<button className='btn-dd'>buy now</button>

Expand Down
6 changes: 4 additions & 2 deletions src/component/WomenDescription.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import React, { useEffect, useState } from 'react';
import { Link, useParams } from 'react-router-dom';
import womenList from '../data/womenList';
import allComponents from "../component/styles/allComponents.css";
import { Button } from "react-bootstrap";

import { useCart } from 'react-use-cart';

const WomenDescription = () => {
const params = useParams();
Expand All @@ -15,7 +17,7 @@ const WomenDescription = () => {
}
})
}, [elect])

const { addItem }= useCart();
return (
<>
<div className='cards-box'>
Expand All @@ -26,7 +28,7 @@ const WomenDescription = () => {
<h4>{elect.productName}</h4>
<h4>{elect.price}</h4>
<div className='link-plus'>
<i className='fas fa-cart-plus'></i>
<Button onClick={() =>addItem(elect)}> <i className='fas fa-cart-plus'></i></Button>
</div>
<button className='btn-dd'>buy now</button>

Expand Down
15 changes: 13 additions & 2 deletions src/component/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,18 @@ import { Link } from "react-router-dom";
import { SidebarData } from "./SidebarData";
import { IconContext } from "react-icons";
import { Icon } from "@mui/material";
import { useCart } from 'react-use-cart'

const Header = ({size}) => {
const {
isEmpty,
totalItems,

}= useCart();
const [show,setshow] =useState(true);

const [warning, setwarning]= useState(false);

const Header = () => {
const [sidebar, setSidebar] = useState(false);

const showSidebar = () => setSidebar(!sidebar);
Expand Down Expand Up @@ -113,8 +123,9 @@ const Header = () => {
<img src={user}></img>
<h4>Login</h4>
</a>
<a href="#">
<a href="/cart">
<img src={cart}></img>
{!isEmpty && <span style={{ position:'relative', left: '-21px', top: '-18px'}}>{totalItems}</span>}
<h4>Cart</h4>
</a>
{/* <a href="#"><img src={order}></img><span></span><h4 >order</h4></a> */}
Expand Down
4 changes: 2 additions & 2 deletions src/component/signIn.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React from "react";
import "./signIn.css";
import onlineshopping from "../images/cart-image.JPG";
import picture from'../assets/image/picture.jpg';

function SignIn() {
return (
<div className="container1">
<div>
<img src={onlineshopping} alt="" id="picture" />
<img src={picture} alt="" id="picture" />
</div>
;.
<div className="container3">
Expand Down
15 changes: 13 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
import React from "react";
import ReactDOM from "react-dom";

import { ThemeProvider } from './GlobalComponents/ThemeProvider';
import App from "./App";
import { CartProvider} from 'react-use-cart'
ReactDOM.render(

<ThemeProvider>
<CartProvider>
<App/>
</CartProvider>

</ThemeProvider>



ReactDOM.render(<App/>,document.querySelector("#root"));
,document.querySelector("#root"));
2 changes: 2 additions & 0 deletions src/routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ import HomeLayout from "../component/Homelayout";
import Dashboard from "../views/Dashbord/Dashboard";
import Dashlayout from "../component/admin/DashLayout";
import Dashbrd from "../Dashbrd/Dashbrd";
import { ThemeProvider } from './GlobalComponents/ThemeProvider';
const index = () => {
return (
<>
{/* <HomeLayout> */}
<Routes>
<Route path ="#" element={<Cart/>}/>
<Route path="/login" element={<SignIn />} />
<Route exact path="/Dashboard" element={<Dashboard />} />
<Route exact path="/Dashlayout" element={<Dashlayout />} />
Expand Down
Loading