Skip to content

Commit

Permalink
edit styling to be responsive
Browse files Browse the repository at this point in the history
  • Loading branch information
shabrina12 committed Dec 31, 2022
1 parent 52f10ad commit d8d09e1
Show file tree
Hide file tree
Showing 10 changed files with 481 additions and 71 deletions.
38 changes: 19 additions & 19 deletions components/EventsBanner.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,38 +19,38 @@ const EventsBanner = () => {
<h3>GET UP TO <span>60%</span></h3>
<p>For the summer season</p>
</div>
<Image src={event1} width={260} height={200} alt='event' />
<Image src={event1} alt='event' />
</div>

<div className='event-card'>
<h3>GET 30% Off</h3>
<p>USE PROMO CODE</p>
{/* <div className='code-promo'> */}
<button>DINEWEEKENDSALE</button>
{/* </div> */}
<button>DINEWEEKENDSALE</button>
</div>
</div>

<div className='event-banner-right-1'>
<div className='details'>
<p>Flex Sweatshirt</p>
<div className='price'>
<span>$100.00</span>
<span>$75.00</span>
<div className='event-banner-right'>
<div className='event-banner-right-1'>
<div className='details'>
<p>Flex Sweatshirt</p>
<div className='price'>
<span>$100.00</span>
<span>$75.00</span>
</div>
</div>
<Image src={event2} alt='event' />
</div>
<Image src={event2} width={280} height={340} alt='event' />
</div>

<div className='event-banner-right-2'>
<div className='details'>
<p>Flex Push Button Bomber</p>
<div className='price'>
<span>$225.00</span>
<span>$190.00</span>
<div className='event-banner-right-2'>
<div className='details'>
<p>Flex Push Button Bomber</p>
<div className='price'>
<span>$225.00</span>
<span>$190.00</span>
</div>
</div>
<Image src={event3} alt='event' />
</div>
<Image src={event3} width={280} height={340} alt='event' />
</div>
</div>

Expand Down
2 changes: 1 addition & 1 deletion components/FeaturesBanner.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const FeaturesBanner = () => {
<div>
<p>This piece is ethically crafted in our small family-owned workshop in Peru with unmatched attention to detail and care. The Natural color is the actual natural color of the fiber, undyed and 100% traceable.</p>
<Link href={'/products'}>
<button type='button'>See All Product</button>
<button className='btn' type='button'>See All Product</button>
</Link>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion components/HeroBanner.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const HeroBanner = () => {
<h1>An Industrial Take on Streetwear</h1>
<p>Anyone can beat you but no one can beat your outfit as long as you wear Dine outfits.</p>
<Link href='/products'>
<button type='button'><CgShoppingCart size={26} /> Start Shopping</button>
<button className='btn' type='button'><CgShoppingCart size={26} /> Start Shopping</button>
</Link>
</div>
<div className='header-featured'>
Expand Down
34 changes: 31 additions & 3 deletions components/Navbar.jsx
Original file line number Diff line number Diff line change
@@ -1,29 +1,33 @@
import React from 'react'
import React, { useState } from 'react'
import Image from 'next/image'
import {CiSearch} from 'react-icons/ci'
import {CgShoppingCart} from 'react-icons/cg'
import logo from '../src/assets/Logo.png'
import Link from 'next/link'
import {RiMenu3Line, RiCloseLine } from 'react-icons/ri';
import { useStateContext } from '../context/StateContext';

const Navbar = () => {
const {showCart, setShowCart, totalQty} = useStateContext();
const [toggleMenu, setToggleMenu] = useState(false);

return (
<nav>
<Link href='/'>
<Image src={logo} width={140} height={25} alt='logo' />
</Link>
<ul>
<ul className='nav-links'>
<Link href='/female'><li>Female</li></Link>
<Link href='/male'><li>Male</li></Link>
<Link href='/kids'><li>Kids</li></Link>
<Link href='/products'><li>All Products</li></Link>
</ul>

<div className='search-bar'>
<CiSearch />
<input type='text' placeholder='What you looking for'/>
</div>

{showCart ?
<Link href='/cart'>
<button className='cart' onClick={() => setShowCart(false)}>
Expand All @@ -37,6 +41,30 @@ const Navbar = () => {
<span className='cart-item-qty'>{totalQty}</span>
</button>
}

<div className='navbar-smallscreen'>
<RiMenu3Line color='black' fontSize={27} onClick={() => setToggleMenu(true)} />
{toggleMenu && (
<div className='navbar-smallscreen_overlay'>
<Link href='/'>
<Image className='logo-small' src={logo} width={140} height={25} alt='logo' />
</Link>
<RiCloseLine color='black' fontSize={27} className='close_icon' onClick={() => setToggleMenu(false)} />
<ul className='navbar-smallscreen_links'>
<Link href='/cart'>
<button className='cart-small-screen' onClick={() => setShowCart(false)}>
<CgShoppingCart size={22} />
<span className='cart-item-qty'>{totalQty}</span>
</button>
</Link>
<Link href='/female'><li>Female</li></Link>
<Link href='/male'><li>Male</li></Link>
<Link href='/kids'><li>Kids</li></Link>
<Link href='/products'><li>All Products</li></Link>
</ul>
</div>
)}
</div>
</nav>
)
}
Expand Down
2 changes: 1 addition & 1 deletion pages/cart.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ const Cart = () => {
<span>${totalPrice}</span>
</div> */}
<div>
<button type='button' onClick={handleCheckout}>Process to Checkout</button>
<button className='btn' type='button' onClick={handleCheckout}>Process to Checkout</button>
</div>
</div>
)}
Expand Down
33 changes: 25 additions & 8 deletions pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Swiper, SwiperSlide } from 'swiper/react';
import 'swiper/css';
import 'swiper/css/navigation';

const Home = ({products, bannerData}) => {
const Home = ({products}) => {
return (
<>
<HeroBanner />
Expand All @@ -20,10 +20,27 @@ const Home = ({products, bannerData}) => {
<h2>Check What We Have</h2>
</div>
<Swiper
modules={[Navigation, A11y]}
spaceBetween={0}
slidesPerView={3}
navigation
breakpoints={{
// width >= 300
300: {
slidesPerView: 1,
spaceBetween: 100
},
// width >= 1000
1000: {
slidesPerView: 2,
spaceBetween: 0
},
// width >= 1260
1260: {
slidesPerView: 3,
spaceBetween: 0
}
}}
modules={[Navigation, A11y]}
spaceBetween={0}
slidesPerView={3}
navigation
>
<div className='products-container'>
{products?.map(product => (
Expand All @@ -44,11 +61,11 @@ const Home = ({products, bannerData}) => {
export const getServerSideProps = async () => {
const query = '*[_type == "product"]';
const products = await client.fetch(query);
const bannerQuery = '*[_type == "banner"]';
const bannerData = await client.fetch(bannerQuery);
// const bannerQuery = '*[_type == "banner"]';
// const bannerData = await client.fetch(bannerQuery);

return {
props: { products, bannerData }
props: { products }
}
}

Expand Down
2 changes: 1 addition & 1 deletion pages/product/[slug].js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const ProductDetails = ({products, product}) => {
</div>
</div>
<div className='add-to-cart'>
<button type='button' onClick={() => onAdd(product, qty)}><CgShoppingCart size={20} />Add to Cart</button>
<button className='btn' type='button' onClick={() => onAdd(product, qty)}><CgShoppingCart size={20} />Add to Cart</button>
<p className='price'>${price}.00</p>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion pages/successPay.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const successPay = () => {
</a>
</p>
<Link href="/">
<button type="button" width="300px">
<button className='btn' type="button" width="300px">
Continue Shopping
</button>
</Link>
Expand Down
4 changes: 2 additions & 2 deletions sanity-ecommerce-clothing/schemas/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import product from "./product"
import banner from "./banner"
// import banner from "./banner"

export const schemaTypes = [product, banner]
export const schemaTypes = [product]
Loading

0 comments on commit d8d09e1

Please sign in to comment.