Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Functionality to the 'Latest Collections ' button #300

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
7 changes: 7 additions & 0 deletions src/Components/Hero/Hero.css
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,15 @@
color: white;
font-size: 22px;
font-weight: 500;
cursor: pointer;

}
.hero-latest-btn:hover
{
background: #d30202;
color: white;
border: 2px solid #ff4141;
}
.hero-right{
flex:1;
display: flex;
Expand Down
37 changes: 19 additions & 18 deletions src/Components/Hero/Hero.jsx
Original file line number Diff line number Diff line change
@@ -1,34 +1,35 @@
import React, { useContext } from 'react'
import './Hero.css'
import hand_icon from '../Assets/hand_icon.png'
import arrow_icon from '../Assets/arrow.png'
import hero_image from '../Assets/hero_image.png'
import { ShopContext } from '../../Context/ShopContext'
// Hero.jsx
import React, { useContext } from 'react';
import './Hero.css';
import hand_icon from '../Assets/hand_icon.png';
import arrow_icon from '../Assets/arrow.png';
import hero_image from '../Assets/hero_image.png';
import { ShopContext } from '../../Context/ShopContext';

const Hero = () => {
const {theme}=useContext(ShopContext)
const Hero = ({ scrollToNewCollections }) => {
const { theme } = useContext(ShopContext);
return (
<div className={'hero_'+theme}>
<div className={'hero_' + theme}>
<div className="hero-left">
<h2 className={'h2h_'+theme}>NEW ARRIVALS ONLY</h2>
<h2 className={'h2h_' + theme}>NEW ARRIVALS ONLY</h2>
<div>
<div className="hero-hand-icon">
<p className={'ph_'+theme}>New</p>
<p className={'ph_' + theme}>New</p>
<img src={hand_icon} alt="" />
</div>
<p className={'ph_'+theme}>Collections</p>
<p className={'ph_'+theme}>For Everyone</p>
<p className={'ph_' + theme}>Collections</p>
<p className={'ph_' + theme}>For Everyone</p>
</div>
<div className="hero-latest-btn">
<div className={'div_'+theme}>Latest Collection</div>
<div className="hero-latest-btn" onClick={scrollToNewCollections}>
<div className={'div_' + theme}>Latest Collection</div>
<img src={arrow_icon} alt="" />
</div>
</div>
<div className="hero-right">
<img src={hero_image} alt="" />
</div>
</div>
)
}
);
};

export default Hero
export default Hero;
1 change: 1 addition & 0 deletions src/Components/NewCollections/NewCollections.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//Newcollections.jsx
import React, { useContext } from 'react'
import './NewCollections.css'
import new_collection from '../Assets/new_collections'
Expand Down
42 changes: 27 additions & 15 deletions src/Pages/Shop.jsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,33 @@
import React from 'react'
import Hero from '../Components/Hero/Hero'
import Popular from '../Components/Popular/Popular'
import Offers from '../Components/Offers/Offers'
import NewCollections from '../Components/NewCollections/NewCollections'
import NewsLetter from '../Components/NewsLetter/NewsLetter'
import Footer from '../Components/Footer/Footer'
// Shop.jsx
import React, { useRef } from 'react';
import Hero from '../Components/Hero/Hero';
import Popular from '../Components/Popular/Popular';
import Offers from '../Components/Offers/Offers';
import NewCollections from '../Components/NewCollections/NewCollections';
import NewsLetter from '../Components/NewsLetter/NewsLetter';
import Footer from '../Components/Footer/Footer';

const Shop = () => {
const newCollectionsRef = useRef(null);

const scrollToNewCollections = () => {
if (newCollectionsRef.current) {
newCollectionsRef.current.scrollIntoView({ behavior: 'smooth' });
}
};

return (
<div>
<Hero/>
<Popular/>
<Offers/>
<NewCollections/>
<NewsLetter/>
<Hero scrollToNewCollections={scrollToNewCollections} />
<Popular />
<Offers />
<div ref={newCollectionsRef}>
<NewCollections />
</div>
<NewsLetter />
<Footer />
</div>
)
}
);
};

export default Shop
export default Shop;
Loading