import React from 'react';
import Slider from 'react-slick';
import SocialIcon from "./SocialIcon";
import { faChevronRight } from "@fortawesome/free-solid-svg-icons";
import '../Assets/Css/MainSection.scss';
import { useState } from 'react'; // Assuming this is your main scss file path
const MainSection = () => {
const settings = {
infinite: true,
speed: 700,
slidesToShow: 1, // How many slides to show at once
slidesToScroll: 1, // How many slides to scroll at once
autoplay: true, // Automatically move the slides
autoplaySpeed: 2000, // 3 seconds delay for autoplay
pauseOnHover: false, // Prevent pausing when hovered
pauseOnDotsHover: false,
cssEase: 'ease-in-out',
};
const productSliderSettings = {
infinite: true,
speed: 500,
slidesToShow: 3, // You want to display 3 slides
slidesToScroll: 1,
centerMode: true, // This is important to ensure the center is correctly identified
centerPadding: '0px', // No extra padding around the center slide
autoplay: true, // Enable autoplay
autoplaySpeed: 2000, // Slide every 2 seconds
pauseOnHover: false,
cssEase: 'ease', // Smooth easing function
};
// Dummy data for the products (you can replace this with your actual data)
const products = [
{ name: 'Custom Conditioner', image: 'iconic1.png', price: '23.00' },
{ name: 'Custom Shampoo', image: 'iconic2.png', price: '23.00' },
{ name: 'Custom Cream', image: 'iconic3.png', price: '$23.00' }
];
const slidesData = [
{
heading: "SO POPULAR IT SOLD OUT",
text: "Neque porro quisquam est qui dolorem",
buttonText: "Shop Now",
},
{
heading: "NEW ARRIVAL",
text: "Lorem ipsum dolor sit amet",
buttonText: "View Collection",
},
{
heading: "BEST SELLERS",
text: "Consectetur adipiscing elit",
buttonText: "Explore Best Sellers",
},
];
<div className="blog-post">
<img src={require('../Assets/Image/blog-image2.png')} alt="Blog 2" className="blog-image" />
<div className="blog-text">
<p>It is a long established fact <br/>that</p>
<h3>The Best Celebrity Beauty Brands to Shop in 2024</h3>
</div>
</div>
<div className="blog-post">
<img src={require('../Assets/Image/blog-image2.png')} alt="Blog 2" className="blog-image" />
<div className="blog-text">
<p>It is a long established fact <br/>that</p>
<h3>The Best Celebrity Beauty Brands to Shop in 2024</h3>
</div>
</div>
{/* See All Button */}
code
<section className='subscribe-section'>
<div className='heading-container'>
<img src={require('../Assets/Image/bloomLeft.png')} alt="Flower Icon" className='decor-icon left-icon'/>
<h2 className='section-heading'>
<span className='decor-line'>LET'S STAY IN TOUCH</span>
</h2>
<img src={require('../Assets/Image/bloomRight.png')} alt="Flower Icon" className='decor-icon right-icon'/>
</div>
<p className='section-description'>
Get The Latest Beauty Tips Straight To Your Inbox. Can't Wait To Connect
</p>
<div className='subscribe-form'>
<input type="email" placeholder='Enter Email' className='email-input'/>
<button className='subscribe-button'>SUBSCRIBE</button>
</div>
</section>
</section>
);
};
export default MainSection;
@import './variables.scss'; // Correct relative path if 'variables.scss' is in the same directory
convert the code into different react components and make it responsive
Certainly! Refactoring your code into modular components not only makes it more maintainable but also helps in reusability and scalability. Additionally, making the layout responsive ensures a good user experience across different devices.
Below is the refactored code, broken down into different React components. I'll also include the updated SCSS styles with responsive design using media queries.
Components Structure
Firstly, we'll organize your page into the following components:
MainSlider: For the main carousel at the top.
NewLaunchedSection: For the "NEW LAUNCHED" section.
DiscoverHaircareSection: For the "DISCOVER HAIRCARE FOR ALL" section.
TwoImageSection: For the section with two images side by side.
CommixIconicsSection: For the "COMMIX ICONICS PRODUCTS" carousel.
FullWidthImageSection: For the full-width image section.
ExclusiveFestiveCombosSection: For the "EXCLUSIVE FESTIVE COMBOS" section.
OfferSection: For the offer image with a button.
FeaturedSection: For the "WHAT WE'RE LOVING RIGHT NOW" section.
BlogSection: For the blog posts grid.
SubscribeSection: For the newsletter subscription section.
Hide/Show Elements: Use display: none to hide non-essential elements on smaller screens to reduce clutter.
Test on Multiple Devices: Always test your layout on different screen sizes or use browser dev tools to emulate different devices.
Example of Responsive Styles for a Section
Here's an example of how you might update the discover-haircare-section to be responsive:
scss
.discover-haircare-section {
.products-container {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
.product-card {
width: 22%; // Four products per row on large screens
margin-bottom: 20px;
@media (max-width: 1200px) {
width: 30%; // Three products per row
}
@media (max-width: 768px) {
width: 45%; // Two products per row
}
@media (max-width: 480px) {
width: 100%; // One product per row
}
}
}
}
Conclusion
By breaking down your main component into smaller components, your code becomes more organized and easier to manage. Each component can have its own stylesheet if you prefer (e.g., NewLaunchedSection.scss) to keep styles scoped and maintainable.
Making the components responsive ensures that your website or application is accessible and user-friendly on all devices. Remember to test the responsiveness across various devices and screen sizes.
Feel free to adjust and expand upon these components as needed for your application. If you have any questions or need further assistance with specific parts of the code, feel free to ask!