From dc7e82b14360c78557ef9fa1741f65b8956e3042 Mon Sep 17 00:00:00 2001 From: Rei Date: Wed, 15 Feb 2023 18:46:29 +0100 Subject: [PATCH] kollors --- components/ImageSlide.tsx | 74 ++++++++++++++++++------------------- components/Navbar.tsx | 4 +- components/R3Background.tsx | 29 +++++++++------ pages/index.tsx | 2 +- 4 files changed, 57 insertions(+), 52 deletions(-) diff --git a/components/ImageSlide.tsx b/components/ImageSlide.tsx index 397f59f..e53264d 100644 --- a/components/ImageSlide.tsx +++ b/components/ImageSlide.tsx @@ -1,41 +1,41 @@ -import React, {Children, useState} from "react"; -import {AiFillLeftCircle} from 'react-icons/ai'; +import React, { useState } from "react"; +import { AiFillLeftCircle } from "react-icons/ai"; +export const ImageSlide = ({ children }: any) => { + const [current, setCurrent] = useState(0); + const length = children.length; -export const ImageSlide = ({children}:any) => { - const [current, setCurrent] = useState(0); - const length = children.length; - - const array = Children.toArray(children); - console.log(array) - - const nextSlide = () => { - setCurrent(current === length - 1 ? 0 : current + 2); - }; + const nextSlide = () => { + setCurrent(current === length - 1 ? 0 : current + 2); + }; - const prevSlide = () => { - setCurrent(current === 0 ? length - 1 : current - 2); - }; - if(children.length <= 0){ - return null; - }; + const prevSlide = () => { + setCurrent(current === 0 ? length - 1 : current - 2); + }; + if (children.length <= 0) { + return null; + } - return( -
- - - {children.map((slide : any, index : any) => { - return ( -
- {index === current && ( - travel image - )} -
- ); - })} -
- ); -}; \ No newline at end of file + return ( +
+ + + {children.map((slide: any, index: any) => { + return ( +
+ {index === current && ( + travel image + )} +
+ ); + })} +
+ ); +}; diff --git a/components/Navbar.tsx b/components/Navbar.tsx index 375f7c5..2c55f18 100644 --- a/components/Navbar.tsx +++ b/components/Navbar.tsx @@ -13,7 +13,7 @@ export const Navbar = () => { const [showMenu, setShowMenu] = useState(false); return ( -