react-icons/bi#BiLeftArrowAlt TypeScript Examples

The following examples show how to use react-icons/bi#BiLeftArrowAlt. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Nav.tsx    From Intro_to_React with GNU General Public License v2.0 5 votes vote down vote up
icons = [BiSearchAlt, BiHomeAlt, BiLeftArrowAlt, BiMusic]
Example #2
Source File: carousel.tsx    From portfolio with MIT License 4 votes vote down vote up
Carousel: React.SFC<CarouselProps> = ({
  images
}) => {
  const [[page, direction], setPage] = React.useState([0, 0]);
  const [imageIndex, setImageIndex] = React.useState<number>(0);

  const paginate = (newDirection: number) => {
    setPage([page + newDirection, newDirection]);
  };

  // React.useEffect(() => {
  //   setImageIndex(repoId);
  // }, [repoId]);

  const nextImage = (newDirection: number) => {
    paginate(newDirection);
    setImageIndex(imageIndex + 1 < images.length ? imageIndex + 1 : 0);
  };

  const prevImage = (newDirection: number) => {
    paginate(newDirection);
    setImageIndex(
      0 === imageIndex ? images.length - 1 : imageIndex - 1
    );
  };

  return (
    <Flex
      width={"100%"}
      height={"100%"}
      position={"relative"}
      justify-content={"center"}
      align-items={"center"}
    >
      <AnimatePresence initial={false} custom={direction}>
        <MotionImage
          position="absolute"
          width="100%"
          height="100%"
          borderRadius="5px"
          key={page}
          src={images[imageIndex]}
          custom={direction}
          variants={variants}
          initial="enter"
          animate="center"
          exit="exit"
          transition={{
            x: { type: "spring", stiffness: 300, damping: 30 },
            opacity: { duration: 0.2 }
          }}
          drag="x"
          dragConstraints={{ left: 0, right: 0 }}
          dragElastic={1}
          onDragEnd={(e, { offset, velocity }) => {
            const swipe = swipePower(offset.x, velocity.x);

            if (swipe < -swipeConfidenceThreshold) {
              paginate(1);
            } else if (swipe > swipeConfidenceThreshold) {
              paginate(-1);
            }
          }}
        />
      </AnimatePresence>
      <Btn
        icon={<BiLeftArrowAlt />}
        as={BiRightArrowAlt}
        right="25px"
        isRight={true}
        handleImageDir={nextImage}
      />
      <Btn
        icon={<BiRightArrowAlt />}
        as={BiLeftArrowAlt}
        left="25px"
        isRight={false}
        handleImageDir={prevImage}
      />
    </Flex>
  );
}