Skip to content

Commit

Permalink
Temp Carousel
Browse files Browse the repository at this point in the history
  • Loading branch information
kevincharles committed Feb 17, 2023
1 parent 2ceccc3 commit 619b0fc
Show file tree
Hide file tree
Showing 3 changed files with 407 additions and 86 deletions.
48 changes: 47 additions & 1 deletion src/Tools/temp/index.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,57 @@
import React from 'react';
import ReactDOM from 'react-dom';
import styled from 'styled-components';

import { Carousel } from '../../_reactComponents/PanelHeaderComponents/Carousel';

const CarouselSection = styled.div`
display: flex;
flex-direction: column;
padding: 60px 10px 60px 10px;
margin: 0px;
row-gap: 45px;
justify-content: center;
align-items: center;
text-align: center;
background: var(--mainGray);
height: 900px;
/* @media (max-width: 800px) {
height: 500px;
}
@media (max-width: 500px) {
height: 1000px;
} */
`

ReactDOM.render(
<>
<Carousel />
<CarouselSection>
{/* <Carousel title="demo" data={[
{ imagePath: 'https://www.warrenphotographic.co.uk/photography/sqrs/12777.jpg', text: 'slide 1', link: 'doenet.org' },
{ imagePath: 'https://www.warrenphotographic.co.uk/photography/sqrs/12777.jpg', text: 'slide 1', link: 'doenet.org' },
{ imagePath: 'https://www.warrenphotographic.co.uk/photography/sqrs/12777.jpg', text: 'slide 1', link: 'doenet.org' },
{ imagePath: 'https://www.warrenphotographic.co.uk/photography/sqrs/12777.jpg', text: 'slide 1', link: 'doenet.org' },
{ imagePath: 'https://www.warrenphotographic.co.uk/photography/sqrs/12777.jpg', text: 'slide 1', link: 'doenet.org' },
{ imagePath: 'https://www.warrenphotographic.co.uk/photography/sqrs/12777.jpg', text: 'slide 1', link: 'doenet.org' },
]} /> */}
{/* <Carousel title="demo" data={[
{ imagePath: 'https://www.warrenphotographic.co.uk/photography/sqrs/12777.jpg', text: 'slide 1', link: 'doenet.org' },
]} />
<Carousel title="demo" data={[
{ imagePath: 'https://www.warrenphotographic.co.uk/photography/sqrs/12777.jpg', text: 'slide 1', link: 'doenet.org' },
]} /> */}

<Carousel title="demo" data={[
{ imagePath: 'https://www.warrenphotographic.co.uk/photography/sqrs/12777.jpg', text: 'slide 1', link: 'doenet.org' },
{ imagePath: 'https://www.warrenphotographic.co.uk/photography/sqrs/12777.jpg', text: 'slide 2', link: 'doenet.org' },
{ imagePath: 'https://www.warrenphotographic.co.uk/photography/sqrs/12777.jpg', text: 'slide 3', link: 'doenet.org' },
{ imagePath: 'https://www.warrenphotographic.co.uk/photography/sqrs/12777.jpg', text: 'slide 4', link: 'doenet.org' },
{ imagePath: 'https://www.warrenphotographic.co.uk/photography/sqrs/12777.jpg', text: 'slide 5', link: 'doenet.org' },
{ imagePath: 'https://www.warrenphotographic.co.uk/photography/sqrs/12777.jpg', text: 'slide 6', link: 'doenet.org' },
{ imagePath: 'https://www.warrenphotographic.co.uk/photography/sqrs/12777.jpg', text: 'slide 7', link: 'doenet.org' },
]} />
{/* <Carousel title="demo" /> */}
</CarouselSection>
</>,
document.getElementById('root'),
);
Expand Down
253 changes: 253 additions & 0 deletions src/_reactComponents/PanelHeaderComponents/Carousel copy.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,253 @@
import React, { useRef } from "react";

import SwiperCore, {
// Navigation,
Keyboard,
Mousewheel,
Pagination,
A11y
} from "swiper";
import { Swiper, SwiperSlide } from "swiper/react";

// Import Swiper styles
import "swiper/css";
// import "swiper/css/navigation";
import "swiper/css/pagination";
import "swiper/css/keyboard";
import "./Carousel.css";

import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import {
faChevronLeft,
faChevronRight
} from "@fortawesome/free-solid-svg-icons";
import styled from "styled-components";

SwiperCore.use([Keyboard, Mousewheel]);

function Card({ text }) {
return (
<div
style={{
display: "flex",
alignItems: "center",
flexDirection: "column",
height: "180px",
border: "2px solid #949494",
borderRadius: "6px"
}}
>
<div
style={{
display: "flex",
justifyContent: "center",
alignItems: "center",
width: "100%",
height: "128px",
background: "#121212",
borderRadius: "5px 5px 0px 0px"
}}
>
Image here
</div>
<div
style={{
height: "54px",
width: "100%",
color: "black"
}}
>
{text}
</div>
</div>
);
}

const LeftChevron = styled(FontAwesomeIcon)`
color: #949494;
font-size: 50px;
margin-top: 65px;
cursor: pointer;
&: hover {
color: #0e1111;
}
`;

const RightChevron = styled(FontAwesomeIcon)`
color: #949494;
font-size: 50px;
margin-top: 65px;
cursor: pointer;
&: hover {
color: #0e1111;
}
`;

export function Carousel() {
const swiperElRef = useRef(null);

const pagination = {
clickable: true,
renderBullet: function (index, className) {
return `<span class="${className}" ></span>`;
}
};

const keyboard = {
enabled: true
// onlyInViewport: false
};

const mousewheel = {
forceToAxis: true,
// sensitivity: 100,
thresholdDelta: 6
// thresholdTime: 1000,
};

return (
<>
<div
style={{
display: "flex",
justifyContent: "center"
}}
>
<div
style={{
border: "2px solid #949494",
borderRadius: "6px",
padding: "10px",
minWidth: "320px",
maxWidth: "1000px",
width: "80%",
textAlign: "center"
// display:"flex",
// flexDirection:"column",
// justifyContent:"center",
}}
>
<div style={{ display: "inline-block", padding: "4px" }}>Title</div>
<div style={{ display: "flex" }}>
<LeftChevron
icon={faChevronLeft}
onClick={() => {
swiperElRef.current.swiper.slidePrev();
}}
/>
test
{/* <Swiper
ref={swiperElRef} >
<SwiperSlide>one</SwiperSlide>
<SwiperSlide>two</SwiperSlide>
<SwiperSlide>three</SwiperSlide>
</Swiper> */}
{/* <Swiper
ref={swiperElRef}
style={{ height: "230px" }}
modules={[Pagination, A11y]}
// modules={[Navigation, Pagination, A11y]}
// navigation
keyboard={keyboard}
pagination={pagination}
mousewheel={mousewheel}
spaceBetween={15}
slidesPerView={1}
slidesPerGroup={1}
breakpoints={{
310: {
slidesPerView: 2,
slidesPerGroup: 2
},
550: {
slidesPerView: 3,
slidesPerGroup: 3
},
790: {
slidesPerView: 4,
slidesPerGroup: 4
},
1000: {
slidesPerView: 5,
slidesPerGroup: 5
},
// 950: {
// slidesPerView: 6,
// slidesPerGroup: 6
// }
}}
// onSwiper={(swiper) => console.log("swiper", swiper)}
// onSlideChange={() => console.log("slide change")}
> */}
{/* <SwiperSlide>
<Card text="Slide 1" />
</SwiperSlide>
<SwiperSlide>
<Card text="Slide 2" />
</SwiperSlide>
<SwiperSlide>
<Card text="Slide 3" />
</SwiperSlide>
<SwiperSlide>
<Card text="Slide 4" />
</SwiperSlide>
<SwiperSlide>
<Card text="Slide 5" />
</SwiperSlide>
<SwiperSlide>
<Card text="Slide 6" />
</SwiperSlide>
<SwiperSlide>
<Card text="Slide 7" />
</SwiperSlide>
<SwiperSlide>
<Card text="Slide 8" />
</SwiperSlide> */}
{/* <SwiperSlide>
<Card text="Slide 9" />
</SwiperSlide>
<SwiperSlide>
<Card text="Slide 10" />
</SwiperSlide>
<SwiperSlide>
<Card text="Slide 11" />
</SwiperSlide>
<SwiperSlide>
<Card text="Slide 12" />
</SwiperSlide> */}
{/* </Swiper> */}

{/* <button
onClick={() => {
// swiperElRef.current.swiper.
swiperElRef.current.swiper.slideTo(0, 100);
}}
>
1
</button>
<button
onClick={() => {
// swiperElRef.current.swiper.
swiperElRef.current.swiper.slideTo(3, 100);
}}
>
4
</button> */ }
<RightChevron
icon={faChevronRight}
onClick={() => {
swiperElRef.current.swiper.slideNext();
}}
/>
</div>
</div>
</div>
</>
);
// return <div>
// <LeftChevron icon={faChevronLeft} />
// <Card text="my test" />
// <RightChevron icon={faChevronRight} />
// </div>
}

Loading

0 comments on commit 619b0fc

Please sign in to comment.