import { ArrowLeftOutlined, ArrowRightOutlined } from '@ant-design/icons'; import cx from 'classnames'; import { FormattedMessage, Link, useLocale } from 'dumi'; import React from 'react'; import Slider from 'react-slick'; import { ic, icWithLocale } from '../../../../slots/hooks'; import { IC } from '../../../../types'; import 'slick-carousel/slick/slick-theme.css'; import 'slick-carousel/slick/slick.css'; import styles from './index.module.less'; interface Case { logo?: string; isAppLogo?: boolean; title: IC; description: IC; link?: string; image: string; } interface CasesProps { cases: Case[]; style?: React.CSSProperties; className?: string; } export const Cases: React.FC = ({ cases = [], style = {}, className }) => { const lang = useLocale().id; const slider = React.useRef(null); const clickPrevious = () => { slider.current?.slickPrev(); }; const clickNext = () => { slider.current?.slickNext(); }; const getCases = () => { let buttons: any; if (cases.length > 1) { buttons = (
); } const children = cases.map((app) => { const linkDiv = (
{app.link && app.link.startsWith('http') ? ( {} ) : ( {} )}
); return (
{ic(app.title)}
logo

{ic(app.title)}

{ic(app.description)}

{linkDiv}
{buttons}
); }); return children; }; const sliderSettings = { dots: cases.length > 1, infinite: true, slidesToShow: 1, adaptiveHeight: true, speed: 500, cssEase: 'linear', arrows: false, autoplay: true, autoplaySpeed: 3000, fade: true, }; return (
{getCases()}
); };