/* eslint-disable jsx-a11y/click-events-have-key-events */ /* eslint-disable jsx-a11y/no-static-element-interactions */ import React, { ReactNode } from "react"; import cls from 'classnames'; import { cssClasses } from '@douyinfe/semi-foundation/carousel/constants'; import { CarouselArrowProps } from "./interface"; import { IconChevronLeft, IconChevronRight } from "@douyinfe/semi-icons"; import { get } from 'lodash'; class CarouselArrow extends React.PureComponent { renderLeftIcon = () => { return get(this.props, 'arrowProps.leftArrow.children', ); } renderRightIcon = () => { return get(this.props, 'arrowProps.rightArrow.children', ); } render(): ReactNode { const { type, theme, prev, next } = this.props; const classNames = cls( { [cssClasses.CAROUSEL_ARROW]: true, [`${cssClasses.CAROUSEL_ARROW}-${theme}`]: theme, [`${cssClasses.CAROUSEL_ARROW}-hover`]: type === 'hover', }); const leftClassNames = cls( { [`${cssClasses.CAROUSEL_ARROW}-prev`]: true, [`${cssClasses.CAROUSEL_ARROW}-${theme}`]: theme, }); const rightClassNames = cls( { [`${cssClasses.CAROUSEL_ARROW}-next`]: true, [`${cssClasses.CAROUSEL_ARROW}-${theme}`]: theme, }); return (
{this.renderLeftIcon()}
{this.renderRightIcon()}
); } } export default CarouselArrow;