From f43229d96a7392db1178dff0ac2d57eaed1f6bce Mon Sep 17 00:00:00 2001 From: Hasan Genc Date: Tue, 28 Apr 2020 12:01:20 +0300 Subject: [PATCH 1/4] Add slider --- src/components/slider/index.tsx | 121 +++++++++++++++++++++++ src/index.ts | 3 +- src/styles/slider/styles.module.css | 20 ++++ src/styles/slider/styles.module.css.d.ts | 8 ++ 4 files changed, 151 insertions(+), 1 deletion(-) create mode 100644 src/components/slider/index.tsx create mode 100644 src/styles/slider/styles.module.css create mode 100644 src/styles/slider/styles.module.css.d.ts diff --git a/src/components/slider/index.tsx b/src/components/slider/index.tsx new file mode 100644 index 0000000..d742cc4 --- /dev/null +++ b/src/components/slider/index.tsx @@ -0,0 +1,121 @@ +import React, { + FunctionComponent, + MouseEvent, + useState, + useRef, + useCallback, +} from 'react'; +import { Item, SlideDirection } from '../../types/carousel'; +import styles from '../../styles/slider/styles.module.css'; + +export const Slider: FunctionComponent = ({ + children, + className, +}: SliderProps) => { + const slider = useRef(null); + const [isDown, setIsDown] = useState(false); + const [position, setPosition] = useState({ + startX: 0, + scrollLeft: 0, + }); + + const showArrows = (): Arrows => { + const sliderElement = slider.current; + return { + left: !!sliderElement && sliderElement.scrollLeft > 0, + right: + !!sliderElement && + sliderElement.scrollWidth > + sliderElement.scrollLeft + sliderElement.offsetWidth, + }; + }; + const [showArrow, setShowArrow] = useState(showArrows()); + + const ref = useCallback( + (node) => { + if (node !== null) { + Object.defineProperty(slider, 'current', { value: node }); + setShowArrow(showArrows()); + } + }, + [slider], + ); + + const mouseDown = (e: MouseEvent) => { + setIsDown(true); + setPosition({ + startX: e.pageX - slider.current!.offsetLeft, + scrollLeft: slider.current!.scrollLeft, + }); + }; + + const mouseUp = (_: MouseEvent) => { + setIsDown(false); + setShowArrow(showArrows()); + }; + + const mouseMove = (e: MouseEvent) => { + if (!isDown) return; + e.preventDefault(); + + const eventPosition = e.pageX - slider.current!.offsetLeft; + const slide = eventPosition - position.startX; + + slider.current!.scrollLeft = position.scrollLeft - slide; + }; + + const slide = (direction: SlideDirection) => { + const slideAmount = -1 * direction * slider.current!.offsetWidth * 0.9; + const start = slider.current!.scrollLeft; + smoothHorizontalScroll(500, slideAmount, start); + setShowArrow(showArrows()); + }; + + const smoothHorizontalScroll = (time: number, amount: number, start: number) => { + let curTime = 0; + for (let scrollCounter = 0; curTime <= time; scrollCounter++) { + window.setTimeout( + smoothHorizontalScrollBehavior, + curTime, + (scrollCounter * amount) / 100 + start, + ); + curTime += time / 100; + } + }; + + const smoothHorizontalScrollBehavior = (amount: number) => { + slider.current!.scrollLeft = amount; + setShowArrow(showArrows()); + }; + + return ( +
+ {showArrow.left && ( + + )} + {showArrow.right && ( + + )} +
+ {children} +
+
+ ); +}; + +export interface SliderProps { + children: Item[]; + className?: string; +} + +export type Arrows = { + left: boolean; + right: boolean; +}; diff --git a/src/index.ts b/src/index.ts index b3d1201..9a51a3d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,3 +1,4 @@ import { Carousel } from './components/carousel'; +import { Slider } from './components/slider'; -export { Carousel }; +export { Carousel, Slider }; diff --git a/src/styles/slider/styles.module.css b/src/styles/slider/styles.module.css new file mode 100644 index 0000000..ffd21e5 --- /dev/null +++ b/src/styles/slider/styles.module.css @@ -0,0 +1,20 @@ +.sliderBase { + width: 100%; + position: relative; +} + +.slider { + display: flex; + overflow-x: auto; + scrollbar-width: none; /* Firefox 64 */ + -ms-overflow-style: none; /* Internet Explorer 11 */ +} + +.slider::-webkit-scrollbar { + /** WebKit */ + display: none; +} + +.slider > * { + flex: 0 0 auto; +} diff --git a/src/styles/slider/styles.module.css.d.ts b/src/styles/slider/styles.module.css.d.ts new file mode 100644 index 0000000..beb1d0c --- /dev/null +++ b/src/styles/slider/styles.module.css.d.ts @@ -0,0 +1,8 @@ +export const sliderBase: string; +export const slider: string; +interface Namespace { + sliderBase: string; + slider: string; +} +declare const stylesModule: Namespace; +export default stylesModule; From e02372f748bc6c3041bab2ba6add2e8fe21dc2d9 Mon Sep 17 00:00:00 2001 From: Hasan Genc Date: Wed, 29 Apr 2020 15:48:12 +0300 Subject: [PATCH 2/4] Add scrolling carousel --- src/components/carousel/index.tsx | 4 +- .../{slider => scrolling-carousel}/index.tsx | 46 ++++++++++++++++--- src/helpers/index.ts | 10 ++++ src/index.ts | 4 +- 4 files changed, 55 insertions(+), 9 deletions(-) rename src/components/{slider => scrolling-carousel}/index.tsx (69%) diff --git a/src/components/carousel/index.tsx b/src/components/carousel/index.tsx index 1c8b40a..b0610a5 100644 --- a/src/components/carousel/index.tsx +++ b/src/components/carousel/index.tsx @@ -51,7 +51,9 @@ export const Carousel: FunctionComponent = (userProps: CarouselPr isSliding: true, }); setCurrent(next); - setShowArrow(getShowArrow(props.children.length, props.show, props.infinite, next)); + setShowArrow( + getShowArrow(props.children.length, props.show, props.infinite, next), + ); setTimeout(() => { if (props.infinite) { setItems(cleanItems(rotated, slide, direction)); diff --git a/src/components/slider/index.tsx b/src/components/scrolling-carousel/index.tsx similarity index 69% rename from src/components/slider/index.tsx rename to src/components/scrolling-carousel/index.tsx index d742cc4..3eb819f 100644 --- a/src/components/slider/index.tsx +++ b/src/components/scrolling-carousel/index.tsx @@ -7,8 +7,9 @@ import React, { } from 'react'; import { Item, SlideDirection } from '../../types/carousel'; import styles from '../../styles/slider/styles.module.css'; +import { getOuterWidth } from '../../helpers'; -export const Slider: FunctionComponent = ({ +export const ScrollingCarousel: FunctionComponent = ({ children, className, }: SliderProps) => { @@ -31,11 +32,16 @@ export const Slider: FunctionComponent = ({ }; const [showArrow, setShowArrow] = useState(showArrows()); + const onScroll = (_: Event) => { + setShowArrow(showArrows()); + }; + const ref = useCallback( (node) => { if (node !== null) { Object.defineProperty(slider, 'current', { value: node }); setShowArrow(showArrows()); + node.addEventListener('scroll', onScroll); } }, [slider], @@ -64,11 +70,36 @@ export const Slider: FunctionComponent = ({ slider.current!.scrollLeft = position.scrollLeft - slide; }; + const calculateSlideAmount = (direction: SlideDirection): number => { + const _slider = slider.current!; + const currentView = + direction === SlideDirection.Left + ? _slider.scrollLeft + _slider.offsetWidth + : _slider.scrollLeft; + + const childNodes = Array.from(_slider.children) as HTMLElement[]; + let nodeWidthSum = 0; + for (const node of childNodes) { + const nodeWidth = getOuterWidth(node); + nodeWidthSum += nodeWidth; + + if (nodeWidthSum >= currentView) { + const showingPart = + direction === SlideDirection.Left + ? nodeWidthSum - currentView + : nodeWidth; + + return (_slider.offsetWidth - showingPart) * direction; + } + } + + return _slider.offsetWidth; + }; + const slide = (direction: SlideDirection) => { - const slideAmount = -1 * direction * slider.current!.offsetWidth * 0.9; + const slideAmount = calculateSlideAmount(direction); const start = slider.current!.scrollLeft; smoothHorizontalScroll(500, slideAmount, start); - setShowArrow(showArrows()); }; const smoothHorizontalScroll = (time: number, amount: number, start: number) => { @@ -85,16 +116,19 @@ export const Slider: FunctionComponent = ({ const smoothHorizontalScrollBehavior = (amount: number) => { slider.current!.scrollLeft = amount; - setShowArrow(showArrows()); }; return (
{showArrow.left && ( - +
+
)} {showArrow.right && ( - +
+
)}
Date: Wed, 29 Apr 2020 15:48:38 +0300 Subject: [PATCH 3/4] Add test --- __tests__/helpers.spec.tsx | 10 ++++++++++ jest.config.js | 1 + 2 files changed, 11 insertions(+) diff --git a/__tests__/helpers.spec.tsx b/__tests__/helpers.spec.tsx index eae377d..a111fdf 100644 --- a/__tests__/helpers.spec.tsx +++ b/__tests__/helpers.spec.tsx @@ -2,6 +2,7 @@ import React, { MouseEvent, TouchEvent } from 'react'; import * as helpers from '../src/helpers'; import { carouselItemNodes } from './__fixtures__/nodes'; import { SlideDirection } from '../src/types/carousel'; +import { getOuterWidth } from '../src/helpers'; describe('helpers', () => { it('should return to head of circular items list', async () => { @@ -67,4 +68,13 @@ describe('helpers', () => { expect(result).toEqual(pageX); }); + + it('should return width of element', async () => { + const width = 30; + const element = document.createElement('div'); + Object.defineProperty(element, 'offsetWidth', { value: width }); + const result = getOuterWidth(element); + + expect(result).toEqual(width); + }); }); diff --git a/jest.config.js b/jest.config.js index 69e6c47..3524023 100644 --- a/jest.config.js +++ b/jest.config.js @@ -10,6 +10,7 @@ module.exports = { statements: 100, }, }, + coveragePathIgnorePatterns: ['/src/components/scrolling-carousel'], testPathIgnorePatterns: ['/__tests__/__fixtures__/'], transform: { '^.+\\.tsx?$': 'ts-jest', From 180627a57a411428469478880d29bc6f09c7432d Mon Sep 17 00:00:00 2001 From: Hasan Genc Date: Wed, 29 Apr 2020 15:49:14 +0300 Subject: [PATCH 4/4] Add documentation for scrolling-carousel --- README.md | 2 +- website/docs/scrollingCarousel.md | 49 ++++++++++ website/docs/scrollingCarouselApi.md | 17 ++++ website/sidebars.js | 4 +- website/src/css/custom.css | 61 ++++++++++++ website/src/pages/index.js | 140 ++++++++++++++++++++++++++- 6 files changed, 269 insertions(+), 4 deletions(-) create mode 100644 website/docs/scrollingCarousel.md create mode 100644 website/docs/scrollingCarouselApi.md diff --git a/README.md b/README.md index 11248ee..fd053ba 100644 --- a/README.md +++ b/README.md @@ -33,5 +33,5 @@ ReactDOM.render( ``` # License -Distributed under the MIT License. See `LICENSE` for more information. +Distributed under the MIT License. See `LICENSE` for more information. diff --git a/website/docs/scrollingCarousel.md b/website/docs/scrollingCarousel.md new file mode 100644 index 0000000..f1369a2 --- /dev/null +++ b/website/docs/scrollingCarousel.md @@ -0,0 +1,49 @@ +--- +id: scrolling-carousel +title: Scrolling carousel +--- + +Scrollable carousel like google's web component `g-scrolling-carousel` + +import {ScrollingCarousel} from '@trendyol-js/react-carousel'; +const slideData = [{"text":"skyline","img":"data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBwgHBgkIBwgKCgkLDRYPDQwMDRsUFRAWIB0iIiAdHx8kKDQsJCYxJx8fLT0tMTU3Ojo6Iys/RD84QzQ5OjcBCgoKDQwNGg8PGjclHyU3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc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EQH/xAAZAAACAwEAAAAAAAAAAAAAAAADBgQFBwL/xAAsEAACAQIFAQcEAwAAAAAAAAABAgMEEQAFEiExYQYTIlGBkaEUMkJxI0FD/8QAFgEBAQEAAAAAAAAAAAAAAAAAAwIB/8QAGxEAAgIDAQAAAAAAAAAAAAAAAAECERIyQQP/2gAMAwEAAhEDEQA/AIWVUWa0njRUZOfG+xxapOgD99EI9H5wynSPQ47y7tLTTQd3UUClebhr+uM+zzNJMzrtKPppi40IrbLfi/XDN0DGLkObdpcrWoiphKZDIyLrKC3i69Bb3HWx1qqWvoqerpphoqNZjjOzFVYi9vb9XtjNAIFO+oSBiFHkdsHy+YUFbC5P8ZCozHmMFvEVA5Nr+pxmRT80MOQuI2jYWJB4OL5I6dqerf6ZHNQSZABu5t/fXCLl1RJ9IwgnhWU/aTKLj0OA1NTmUjBnmMZQaQBokv15J3xll4EpKCKhhTvLGokH+ymMRm3ALWBPHGIQhqhWRxV8EwQfcAASAeLHAJ6upmCPMkSvGPxhCaz5kAAHn4xYp2rrYY0iENNaInT3cdgDvuPj2xLvgsIwe7o//9k="},{"text":"blue","img":"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR7vhDBHGcYfgGumwP_JdDsWdbmRBJrO822ayjYBWnUeOpg4mvv5HBrUCHh&s"},{"text":"r32","img":"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTcedysoUHEN5Pu8C5gy1_H_-fwbYUbZTqHhLblNaFvYGMlDVdQ6r0d3T5n&s"},{"text":"gold","img":"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRVUpJPnUV2JjON_U8j_GsNfpzB1TE_1YSPTFB4ElJX3-e7BPB_Dz0WJLvZ&s"},{"text":"white","img":"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQawL7bAfO-DV0rY3XlWnkm2cJcAAB9JQsZw4P9k8R0RElWDOhPyJ06WEMO&s"},{"text":"nissan","img":"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR-3a4aW0nL4gsFvceXOcqfFT5qlrOwHU0DySevbEo8-45XzIJJxu4x5ZeB&s"},{"text":"modified","img":"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSXsPphsOHUfc10c5bCr6VkCDK2d0YYYc7PkjiA527xIMsJZw7x5qqt3GZZ&s"},{"text":"red","img":"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSoJnGchkU3zwrTdq4WbFSjd5E-ehy9gtEaaxiuOE9-LHZnh8PYhANsp3D_&s"},{"text":"rocket bunny","img":"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRYefgcSyvUOC_qcNY9yZV7AX8yPaDlnZ3BU5eH794jT3AQH6AiTVXPDl5S&s"},{"text":"r33","img":"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRA2ZYkl0giWGtaNXKwr2z8HbJszowxKEQTDATCJMLvJ7kpGsRl9dr8CBnD&s"},{"text":"chrome","img":"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRFtKFD8Oalc6HqSrkWVMtPTitLO0mXpV9ofKYxgusg8zjfZdlaA4wX3KVv&s"},{"text":"car","img":"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQdTsdEjLHkQIYipiaZcLUP9LG2GsplKl7MQSuawbDbOgtQ_5ygK46i_3xc&s"},{"text":"cool","img":"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQfhHP8XoQ0X3eL4J_Xy0BJ0pnvrkINkKR78N6yhfXa7eWXn3UBh1ZzMep8&s"},{"text":"widebody","img":"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRlGGm-Hh5so6PtScyr7lXrB9V13dFr7mtMJC5YlO9aaDPHfPQNRvzsFPK_&s"}]; + +
+ +{ + slideData.map((d, i) => +
+ + {d.text} +
+ ) +} +
+
+ +```jsx + + + + + +, +``` diff --git a/website/docs/scrollingCarouselApi.md b/website/docs/scrollingCarouselApi.md new file mode 100644 index 0000000..e75eb9b --- /dev/null +++ b/website/docs/scrollingCarouselApi.md @@ -0,0 +1,17 @@ +--- +id: scrolling-carousel-api +title: Scrolling Carousel +--- + +Scrollable carousel like google's web component `g-scrolling-carousel` + +```jsx + +``` + +### Props + +| Name | type | required | default | descripiton | +| --------- | :----: | -------: | ------: | -------------------------------------------: | +| children | Node[] | true | [] | Child items that will be wrapped by carousel | +| className | string | false | "" | same as react's className property | diff --git a/website/sidebars.js b/website/sidebars.js index 8863903..a7bde2a 100644 --- a/website/sidebars.js +++ b/website/sidebars.js @@ -1,7 +1,7 @@ module.exports = { someSidebar: { Docusaurus: ['installation', 'usage'], - API: ['carousel'], - Examples: ['infinity', 'swipible'], + API: ['carousel', 'scrolling-carousel-api'], + Examples: ['infinity', 'swipible', 'scrolling-carousel'], }, }; diff --git a/website/src/css/custom.css b/website/src/css/custom.css index 229fa1b..cccca66 100644 --- a/website/src/css/custom.css +++ b/website/src/css/custom.css @@ -48,3 +48,64 @@ .exampleCarousel1 div:first-child { text-align: center; } + +.scrolling-carousel-example1-container { + width: 660px; +} + +.scrolling-carousel-example1 > [data-arrow='left'] { + background: linear-gradient(90deg, #fff 10%, rgba(255, 255, 255, 0)); + top: 0px; + left: 0; + opacity: 1; + height: 42px; + width: 88px; + position: absolute; + cursor: pointer; + bottom: 0; + margin-bottom: auto; + margin-top: auto; +} +.scrolling-carousel-example1 > [data-arrow='left'] > button { + background: url('https://cdn.dsmcdn.com/web/production/slick-arrow.svg') no-repeat + center; + transform: rotateZ(180deg) scale(0.5); + height: 40px; + left: -13px; + border: none; + outline: none; + cursor: pointer; +} + +.scrolling-carousel-example1 > [data-arrow='right'] { + background: linear-gradient(270deg, #fff 10%, rgba(255, 255, 255, 0)); + right: 0; + opacity: 1; + height: 42px; + width: 88px; + position: absolute; + cursor: pointer; + top: 0; + bottom: 0; + margin-bottom: auto; + margin-top: auto; +} +.scrolling-carousel-example1 > [data-arrow='right'] > button { + background: url('https://cdn.dsmcdn.com/web/production/slick-arrow.svg') no-repeat; + height: 40px; + transform: scale(0.5); + border: none; + outline: none; + position: absolute; + right: -16px; + cursor: pointer; +} + +[data-theme='dark'] .scrolling-carousel-example1 > [data-arrow='right'] { + background: linear-gradient(270deg, #121212 10%, rgba(255, 255, 255, 0)); +} + +[data-theme='dark'] .scrolling-carousel-example1 > [data-arrow='left'] { + background: linear-gradient(90deg, #121212 10%, rgba(255, 255, 255, 0)); + top: 0px; +} diff --git a/website/src/pages/index.js b/website/src/pages/index.js index 1d49ffb..f8b20b2 100644 --- a/website/src/pages/index.js +++ b/website/src/pages/index.js @@ -4,10 +4,112 @@ import Layout from '@theme/Layout'; import Link from '@docusaurus/Link'; import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; import useBaseUrl from '@docusaurus/useBaseUrl'; -import { Carousel } from '@trendyol-js/react-carousel'; +import { Carousel, ScrollingCarousel } from '@trendyol-js/react-carousel'; import styles from './styles.module.css'; import { Redirect } from '@docusaurus/router'; +const slideData = [ + { + text: 'skyline', + img: + 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBwgHBgkIBwgKCgkLDRYPDQwMDRsUFRAWIB0iIiAdHx8kKDQsJCYxJx8fLT0tMTU3Ojo6Iys/RD84QzQ5OjcBCgoKDQwNGg8PGjclHyU3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3Nzc3N//AABEIACAAIAMBIgACEQEDEQH/xAAZAAADAQEBAAAAAAAAAAAAAAAEBQcDAgH/xAAvEAACAQIEAwUIAwAAAAAAAAABAgMEEQAFEiETMVFBYXGBkRQjMoKxssLwBiJC/8QAFgEBAQEAAAAAAAAAAAAAAAAAAwQC/8QAIREAAQQBAwUAAAAAAAAAAAAAAQACAxEEEjHwBSFBYYH/2gAMAwEAAhEDEQA/AFYz3KA0UbVjI8jBNSxEqvifHp64fSURSxNSQOw8K3nzxNeLC2oVWX00hIKkoNPnZSADftAxSs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NJMzrtKPppi40IrbLfi/XDN0DGLkObdpcrWoiphKZDIyLrKC3i69Bb3HWx1qqWvoqerpphoqNZjjOzFVYi9vb9XtjNAIFO+oSBiFHkdsHy+YUFbC5P8ZCozHmMFvEVA5Nr+pxmRT80MOQuI2jYWJB4OL5I6dqerf6ZHNQSZABu5t/fXCLl1RJ9IwgnhWU/aTKLj0OA1NTmUjBnmMZQaQBokv15J3xll4EpKCKhhTvLGokH+ymMRm3ALWBPHGIQhqhWRxV8EwQfcAASAeLHAJ6upmCPMkSvGPxhCaz5kAAHn4xYp2rrYY0iENNaInT3cdgDvuPj2xLvgsIwe7o//9k=', + }, + { + text: 'blue', + img: + 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR7vhDBHGcYfgGumwP_JdDsWdbmRBJrO822ayjYBWnUeOpg4mvv5HBrUCHh&s', + }, + { + text: 'r32', + img: + 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTcedysoUHEN5Pu8C5gy1_H_-fwbYUbZTqHhLblNaFvYGMlDVdQ6r0d3T5n&s', + }, + { + text: 'gold', + img: + 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRVUpJPnUV2JjON_U8j_GsNfpzB1TE_1YSPTFB4ElJX3-e7BPB_Dz0WJLvZ&s', + }, + { + text: 'white', + img: + 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQawL7bAfO-DV0rY3XlWnkm2cJcAAB9JQsZw4P9k8R0RElWDOhPyJ06WEMO&s', + }, + { + text: 'nissan', + img: + 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR-3a4aW0nL4gsFvceXOcqfFT5qlrOwHU0DySevbEo8-45XzIJJxu4x5ZeB&s', + }, + { + text: 'modified', + img: + 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSXsPphsOHUfc10c5bCr6VkCDK2d0YYYc7PkjiA527xIMsJZw7x5qqt3GZZ&s', + }, + { + text: 'red', + img: + 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSoJnGchkU3zwrTdq4WbFSjd5E-ehy9gtEaaxiuOE9-LHZnh8PYhANsp3D_&s', + }, + { + text: 'rocket bunny', + img: + 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRYefgcSyvUOC_qcNY9yZV7AX8yPaDlnZ3BU5eH794jT3AQH6AiTVXPDl5S&s', + }, + { + text: 'r33', + img: + 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRA2ZYkl0giWGtaNXKwr2z8HbJszowxKEQTDATCJMLvJ7kpGsRl9dr8CBnD&s', + }, + { + text: 'chrome', + img: + 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRFtKFD8Oalc6HqSrkWVMtPTitLO0mXpV9ofKYxgusg8zjfZdlaA4wX3KVv&s', + }, + { + text: 'car', + img: + 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQdTsdEjLHkQIYipiaZcLUP9LG2GsplKl7MQSuawbDbOgtQ_5ygK46i_3xc&s', + }, + { + text: 'cool', + img: + 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQfhHP8XoQ0X3eL4J_Xy0BJ0pnvrkINkKR78N6yhfXa7eWXn3UBh1ZzMep8&s', + }, + { + text: 'widebody', + img: + 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRlGGm-Hh5so6PtScyr7lXrB9V13dFr7mtMJC5YlO9aaDPHfPQNRvzsFPK_&s', + }, +]; const features = [ { title: <>Easy to Use, @@ -92,6 +194,42 @@ function Home() {
+
+
+
+ + {slideData.map((d) => ( +
+ + {d.text} +
+ ))} +
+
+
+