Skip to content

Commit

Permalink
Styled the look of product items
Browse files Browse the repository at this point in the history
  • Loading branch information
SadafKausar2025 committed May 23, 2024
1 parent beb354d commit ca475c8
Show file tree
Hide file tree
Showing 5 changed files with 224 additions and 128 deletions.
51 changes: 27 additions & 24 deletions src/Components/Assets/data.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,36 @@
import p1_img from './product_1.png'
import p2_img from './product_2.png'
import p3_img from './product_3.png'
import p4_img from './product_4.png'
import p1_img from "./product_1.png";
import p2_img from "./product_2.png";
import p3_img from "./product_3.png";
import p4_img from "./product_4.png";

let data_product = [
{
id:1,
name:"Striped Flutter Sleeve Overlap Collar Peplum Hem Blouse",
image:p1_img,
new_price:50.00,
old_price:80.50,
id: 1,
name: "Womens Printed Full Sleeve Collared Neck Casual Jacket",
image: p1_img,
new_price: 50.0,
old_price: 80.5,
},
{id:2,
name:"Striped Flutter Sleeve Overlap Collar Peplum Hem Blouse",
image:p2_img,
new_price:85.00,
old_price:120.50,
{
id: 2,
name: "Plain Round Neck Rib Knit Regular Top for Women",
image: p2_img,
new_price: 85.0,
old_price: 120.5,
},
{id:3,
name:"Striped Flutter Sleeve Overlap Collar Peplum Hem Blouse",
image:p3_img,
new_price:60.00,
old_price:100.50,
{
id: 3,
name: "Women's Polyester Sports Bra",
image: p3_img,
new_price: 60.0,
old_price: 100.5,
},
{id:4,
name:"Striped Flutter Sleeve Overlap Collar Peplum Hem Blouse",
image:p4_img,
new_price:100.00,
old_price:150.00,
{
id: 4,
name: "Women's Fall Batwing Half Sleeve Shirts Boat Neck",
image: p4_img,
new_price: 100.0,
old_price: 150.0,
},
];

Expand Down
82 changes: 51 additions & 31 deletions src/Components/Navbar/Navbar.css
Original file line number Diff line number Diff line change
@@ -1,25 +1,29 @@
.navbar{
.navbar {
display: flex;
justify-content: space-around;
padding: 16px;
box-shadow: 0 1px 3px -2px black;
}
.nav-logo{

.nav-logo {
display: flex;
align-items: center;
gap: 10px;
}

.nav-logo-link {
display: flex;
align-items: center;
text-decoration: none;
}
.nav-logo{
}

.nav-logo {
color: #171717;
font-size: 38px;
font-weight: 600;
}
.nav-menu{

.nav-menu {
display: flex;
align-items: center;
list-style: none;
Expand All @@ -28,43 +32,52 @@
font-size: 20px;
font-weight: 500;
}
.nav-menu li{

.nav-menu li {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 3px;
cursor: pointer;
}
.nav-menu li a{text-decoration: none;}
.nav-menu hr{

.nav-menu li a {
text-decoration: none;
}

.nav-menu hr {
border: none;
width: 80%;
height: 3px;
border-radius: 10px;
background: #ff4141;
}
.nav-login-cart{

.nav-login-cart {
display: flex;
align-items: center;
gap:45px;
gap: 45px;
}
.nav-login-cart .log_btn{

.nav-login-cart .log_btn {
width: 157px;
height: 58px;
outline: none;
border:1px solid #7a7a7a;
border: 1px solid #7a7a7a;
border-radius: 75px;
color: #515151;
font-size: 20px;
font-weight: 500;
background: white;
cursor: pointer;
}
.nav-login-cart .log_btn:active{

.nav-login-cart .log_btn:active {
background: #f3f3f3;
}
.nav-cart-count{

.nav-cart-count {
width: 22px;
height: 22px;
display: flex;
Expand All @@ -77,44 +90,53 @@
background: red;
color: white;
}
.dark_btn{

.dark_btn {
width: 50px;
height: 50px;
}
.dark{

.dark {
background: linear-gradient(180deg, black, #e1ffea22 90%);
}
.pnav_dark{

.pnav_dark {
color: #171717;
font-size: 38px;
font-weight: 600;
}
.pnav_light{

.pnav_light {
color: white;
font-size: 38px;
font-weight: 600;
}
.cart{

.cart {
width: 42px;
height: 42px;
}
button{

button {
border: none;
}

.toggle_dark{
background-color:orange;
color: white;
.toggle_dark {
background-color: orange;
color: white;
}
.toggle_light{

.toggle_light {
background-color: #515151;
color: white;
}
.change{
width: 50px;
height: 50px;
border-radius: 50%;

.change {
width: 50px;
height: 50px;
border-radius: 50%;
}

.toggle_dark {
background-color: rgb(232, 212, 177);
color: white;
Expand All @@ -139,6 +161,4 @@ button{
.change img {
width: 80%;
height: auto;
}


}
146 changes: 83 additions & 63 deletions src/Components/Navbar/Navbar.jsx
Original file line number Diff line number Diff line change
@@ -1,70 +1,90 @@
import React, { useContext, useState } from 'react';
import './Navbar.css';
import logo from '../Assets/logo.png';
import cart_icon from '../Assets/cart_icon.png';
import cart_icon_dark from '../Assets/cart_icon_dark.png';
import moonIcon from '../Assets/dark_mode.png';
import sunIcon from '../Assets/light_mode.png';
import { Link } from 'react-router-dom';
import { ShopContext } from '../../Context/ShopContext';
import React, { useContext, useState } from "react";
import "./Navbar.css";
import logo from "../Assets/logo.png";
import cart_icon from "../Assets/cart_icon.png";
import cart_icon_dark from "../Assets/cart_icon_dark.png";
import moonIcon from "../Assets/dark_mode.png";
import sunIcon from "../Assets/light_mode.png";
import { Link } from "react-router-dom";
import { ShopContext } from "../../Context/ShopContext";
import { MdHeight } from "react-icons/md";

const Navbar = () => {
const [icon, setIcon] = useState(cart_icon);
const [menu, setMenu] = useState("shop");
const { getTotalCartItems, theme, setTheme } = useContext(ShopContext);
const [icon, setIcon] = useState(cart_icon);
const [menu, setMenu] = useState("shop");
const { getTotalCartItems, theme, setTheme } = useContext(ShopContext);

const toggle = () => {
if (theme === "dark") {
setTheme("light");
setIcon(cart_icon_dark);
const dnav = document.getElementById("nav");
dnav.classList.add("dark");
} else {
setTheme("dark");
setIcon(cart_icon);
const dnav = document.getElementById("nav");
dnav.classList.remove("dark");
}
};
const toggle = () => {
if (theme === "dark") {
setTheme("light");
setIcon(cart_icon_dark);
const dnav = document.getElementById("nav");
dnav.classList.add("dark");
} else {
setTheme("dark");
setIcon(cart_icon);
const dnav = document.getElementById("nav");
dnav.classList.remove("dark");
}
};

return (
<div className={`navbar`} id="nav">
<div className="nav-logo">
<Link className="nav-logo-link" to="/">
<img src={logo} alt="ShopNex Logo" style={{ marginRight: '10px' }} />
<p className={`pnav_${theme}`}>ShopNex</p>
</Link>
</div>
<ul className="nav-menu">
<li onClick={() => { setMenu("shop") }}>
<Link to='/'>Shop</Link>
{menu === "shop" ? <hr /> : <></>}
</li>
<li onClick={() => { setMenu("men") }}>
<Link to='/men'>Men</Link>
{menu === "men" ? <hr /> : <></>}
</li>
<li onClick={() => { setMenu("women") }}>
<Link to='/women'>Women</Link>
{menu === "women" ? <hr /> : <></>}
</li>
<li onClick={() => { setMenu("kids") }}>
<Link to='/kids'>Kids</Link>
{menu === "kids" ? <hr /> : <></>}
</li>
</ul>
<div className="nav-login-cart">
<Link to='/login'><button className='log_btn'>Login</button></Link>
<Link to='/cart'><img src={icon} alt="" className='cart' /></Link>
<div className="nav-cart-count">{getTotalCartItems()}</div>
<div className='dark_btn'>
<button onClick={toggle} className={`toggle_${theme} change`}>
{theme === 'light' ? <img src={sunIcon} /> : <img src={moonIcon} />}
</button>
</div>
</div>
return (
<div className={`navbar`} id="nav">
<div className="nav-logo">
<Link className="nav-logo-link" to="/">
<img src={logo} alt="ShopNex Logo" style={{ marginRight: "10px" }} />
<p className={`pnav_${theme}`}>ShopNex</p>
</Link>
</div>
<ul className="nav-menu">
<li
onClick={() => {
setMenu("shop");
}}>
<Link to="/">
<i class="fa-brands fa-shopify"></i>
Shop
</Link>
{menu === "shop" ? <hr /> : <></>}
</li>
<li
onClick={() => {
setMenu("men");
}}>
<Link to="/men">Men</Link>
{menu === "men" ? <hr /> : <></>}
</li>
<li
onClick={() => {
setMenu("women");
}}>
<Link to="/women">Women</Link>
{menu === "women" ? <hr /> : <></>}
</li>
<li
onClick={() => {
setMenu("kids");
}}>
<Link to="/kids">Kids</Link>
{menu === "kids" ? <hr /> : <></>}
</li>
</ul>
<div className="nav-login-cart">
<Link to="/login">
<button className="log_btn">Login</button>
</Link>
<Link to="/cart">
<img src={icon} alt="" className="cart" />
</Link>
<div className="nav-cart-count">{getTotalCartItems()}</div>
<div className="dark_btn">
<button onClick={toggle} className={`toggle_${theme} change`}>
{theme === "light" ? <img src={sunIcon} /> : <img src={moonIcon} />}
</button>
</div>
)
}
</div>
</div>
);
};

export default Navbar;
Loading

0 comments on commit ca475c8

Please sign in to comment.