Skip to content

Huzfm/mobile responsive #6591

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

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
60 changes: 43 additions & 17 deletions src/sections/Devrel-platform/picture-slider.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import React from "react";
import Slider from "react-slick";
import styled from "styled-components";
Expand All @@ -7,25 +6,19 @@ import ChallangePNG from "./images/challange_mac.png";
import DesignPNG from "./images/design_mac.png";
import TutorialPNG from "./images/tutorial_mac.png";


const PictureSliderWrapper = styled.div`
display:flex;
justify-content:center;
align-items:center;
text-align:center;
width: 100%;
max-width: 900px;
margin: 0 auto;
text-align: center;

.slick-slider {
margin-top: 1rem;
height:100%;
width: 100%;

.slick-list{
width:100%;
}
@media (max-width: 36rem) {
margin: .5rem auto;
max-width: 100%;
.slick-list {
width: 100%;
}

.slick-prev,
.slick-next {
&:before {
Expand All @@ -39,30 +32,63 @@ const PictureSliderWrapper = styled.div`

.slick-slide {
display: flex;
height: auto;
align-items: center;
justify-content: center;

img {
width: 100%;
max-height: 500px;
object-fit: contain;
}
}
}

@media (max-width: 850px) {
.slick-prev,
.slick-next {
display: none ;
}
}
`;

const PictureSlider = () => {
const data = [ChallangePNG, TutorialPNG, DesignPNG];

const settings = {
dots: false,
infinite: true,
speed: 500,
slidesToShow: 1,
slidesToScroll: 1,
autoplay: true,
autoplaySpeed: 2000
autoplaySpeed: 2000,
responsive: [
{
breakpoint: 1024,
settings: {
slidesToShow: 1,
slidesToScroll: 1,
arrows: false,
autoplay: true,
},
},
{
breakpoint: 600,
settings: {
slidesToShow: 1,
slidesToScroll: 1,
arrows: false,
autoplay: true,
},
},
],
};

return (
<PictureSliderWrapper>
<Slider {...settings}>
{data.map((image, index) => (
<img key={index} src={image} alt="content" />
<img key={index} src={image} alt={`slide-${index}`} />
))}
</Slider>
</PictureSliderWrapper>
Expand Down