mirror of
https://github.com/LucasVbr/meeting-app.git
synced 2026-12-05 17:30:50 +00:00
fix(multiple bugs (map, dashboard, carousel)): multiple bugs (map, dashboard, carousel)
This commit is contained in:
+34
-17
@@ -1,13 +1,13 @@
|
||||
import {useState} from 'react';
|
||||
import {Flex, IconButton} from '@chakra-ui/react';
|
||||
import {BiLeftArrowAlt, BiRightArrowAlt} from 'react-icons/bi';
|
||||
import { useState } from "react";
|
||||
import { Flex, IconButton } from "@chakra-ui/react";
|
||||
import { BiLeftArrowAlt, BiRightArrowAlt } from "react-icons/bi";
|
||||
|
||||
interface Props {
|
||||
images: string[];
|
||||
borderRadius?: string | number;
|
||||
}
|
||||
|
||||
const Carousel = ({images, borderRadius: bRadius}: Props) => {
|
||||
const Carousel = ({ images, borderRadius: bRadius }: Props) => {
|
||||
const [currentIndex, setCurrentIndex] = useState(0);
|
||||
|
||||
const handleClickPrevious = () => {
|
||||
@@ -18,22 +18,39 @@ const Carousel = ({images, borderRadius: bRadius}: Props) => {
|
||||
setCurrentIndex(currentIndex === images.length - 1 ? 0 : currentIndex + 1);
|
||||
};
|
||||
|
||||
if (images.length === 0) images = ['blank_profile_picture.webp'];
|
||||
if (images.length === 0) images = ["blank_profile_picture.webp"];
|
||||
|
||||
return (
|
||||
<Flex px={2} align="center" borderRadius={bRadius} overflow={'hidden'}
|
||||
justify={'space-between'} bgColor={'purple.50'} height={500}
|
||||
bgImage={images[currentIndex]} bgSize={'cover'}
|
||||
bgRepeat={'no-repeat'} bgPosition={'center'} width={'100%'}>
|
||||
<IconButton aria-label="left-arrow" borderRadius="full"
|
||||
onClick={handleClickPrevious}>
|
||||
<BiLeftArrowAlt/>
|
||||
</IconButton>
|
||||
<Flex
|
||||
px={2}
|
||||
align="center"
|
||||
borderRadius={bRadius}
|
||||
overflow={"hidden"}
|
||||
justify={"space-between"}
|
||||
bgColor={"purple.50"}
|
||||
height={500}
|
||||
bgImage={images[currentIndex]}
|
||||
bgSize={"contain"}
|
||||
bgRepeat={"no-repeat"}
|
||||
bgPosition={"center"}
|
||||
width={"100%"}
|
||||
>
|
||||
<IconButton
|
||||
aria-label="left-arrow"
|
||||
borderRadius="full"
|
||||
onClick={handleClickPrevious}
|
||||
>
|
||||
<BiLeftArrowAlt />
|
||||
</IconButton>
|
||||
|
||||
<IconButton aria-label="left-arrow" borderRadius="full" onClick={handleClickNext}>
|
||||
<BiRightArrowAlt/>
|
||||
</IconButton>
|
||||
</Flex>
|
||||
<IconButton
|
||||
aria-label="left-arrow"
|
||||
borderRadius="full"
|
||||
onClick={handleClickNext}
|
||||
>
|
||||
<BiRightArrowAlt />
|
||||
</IconButton>
|
||||
</Flex>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user