chore(carousel): code optimization (#49484)

This commit is contained in:
winches 2024-06-19 11:11:08 +08:00 committed by GitHub
parent f910b5678e
commit e9cc7c1ec0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -31,14 +31,16 @@ export interface CarouselRef {
innerSlider: any;
}
interface ArrowType extends React.ButtonHTMLAttributes<HTMLElement> {
interface ArrowType extends React.ButtonHTMLAttributes<HTMLButtonElement> {
currentSlide?: number;
slideCount?: number;
}
function ArrowButton({ currentSlide, slideCount, ...rest }: ArrowType) {
return <button type="button" {...rest} />;
}
const ArrowButton: React.FC<ArrowType> = ({ currentSlide, slideCount, ...rest }) => (
<button type="button" {...rest} />
);
const dotsClass = 'slick-dots';
const Carousel = React.forwardRef<CarouselRef, CarouselProps>((props, ref) => {
const {
@ -96,7 +98,6 @@ const Carousel = React.forwardRef<CarouselRef, CarouselProps>((props, ref) => {
}
const prefixCls = getPrefixCls('carousel', newProps.prefixCls);
const dotsClass = 'slick-dots';
const enableDots = !!dots;
const dsClass = classNames(