@logicflow/dumi-theme-simple
Version:
Simple website theme based on dumi2.
182 lines (177 loc) • 8.64 kB
JavaScript
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
import React, { useEffect, useState } from 'react';
// Import Swiper React components
import { Swiper, SwiperSlide } from 'swiper/react';
// Import Swiper styles
import 'swiper/css';
import 'swiper/css/pagination';
import 'swiper/css/navigation';
import "./styles.css";
// const swiperData = [
// {
// title: 'LOL 世界赛晋级预测',
// subtitle: 'LogicFLow 晋级流程图',
// desc: '一位热心的LOL玩家利用LogicFlow创建了详细的晋级流程图,并分享了自己对今年小组赛的预测。尽管在最近的比赛中感到沮丧,他依然对京东战队充满信心。该图表展示了各支战队的晋级路径和可能结果,为LOL爱好者提供了一个有趣的讨论点。',
// img: 'https://cdn.jsdelivr.net/gh/Logic-Flow/static@latest/docs/examples/case/bussiness/games.png',
// alt: '比赛晋级图',
// },
// {
// title: '零代码逻辑编排',
// subtitle: '零代码应用',
// desc: '在滴滴客服业务里,通过零代码的方式来配置页面已经有丰富的落地经验,大大的提高了服务用户的效率和质量。但是传统零代码在页面逻辑配置上表现并不好,很难做到灵活扩展。因此,滴滴客服技术团队探索出一种新的思路,用流程编排的方式来编排页面的逻辑,解决零代码的难扩展问题。',
// img: 'https://cdn.jsdelivr.net/gh/Logic-Flow/static@latest/docs/examples/case/bussiness/organizer.png',
// alt: '低代码编排器',
// },
// {
// title: '企业级问卷系统 - XIAOJUSURVEY',
// subtitle: '图形化跳转逻辑应用',
// desc: 'XIAOJUSURVEY是滴滴开源的企业级问卷系统,提供全面、专业和安全的在线调研解决方案。通过集成 LogicFlow 实现了复杂的问卷跳转逻辑,支持市场调研、客户满意度调查和在线考试等多场景应用。通过图形化编排能够直观地创建和维护复杂的问卷流程,轻松实现多条件分支、循环、条件跳转等复杂逻辑,进而提升了系统的灵活性和客户体验。',
// img: 'https://cdn.jsdelivr.net/gh/Logic-Flow/static@latest/docs/homepage/xiaojukeji1.png',
// alt: '小桔问卷',
// },
// ];
// import required modules
import { Autoplay, Parallax, Pagination, Navigation } from 'swiper/modules';
import { Button, Card, Col, Row } from 'antd';
import { map } from 'lodash-es';
import { jsx as _jsx } from "react/jsx-runtime";
import { jsxs as _jsxs } from "react/jsx-runtime";
export function CustomSlider() {
var _useState = useState([]),
_useState2 = _slicedToArray(_useState, 2),
swiperData = _useState2[0],
setSwiperData = _useState2[1];
// const progressCircle = useRef(null);
// const progressContent = useRef(null);
// const onAutoplayTimeLeft = (s, time, progress) => {
// progressCircle.current.style.setProperty('--progress', 1 - progress);
// progressContent.current.textContent = `${Math.ceil(time / 1000)}s`;
// };
useEffect(function () {
fetch('https://my-json-server.typicode.com/Logic-Flow/logicflow-sites-data/swiperCases' // 生产环境
).then(function (res) {
return res.json();
}).then(function (data) {
setSwiperData(data);
}).catch(function () {
setSwiperData([]);
});
}, []);
return /*#__PURE__*/_jsxs(Card, {
children: [/*#__PURE__*/_jsxs(Row, {
style: {
padding: '3.5rem'
},
children: [/*#__PURE__*/_jsxs(Col, {
span: 10,
children: [/*#__PURE__*/_jsx("p", {
className: "",
style: {
letterSpacing: '0.025rem',
lineHeight: 1.625,
fontWeight: 700,
fontSize: '1rem',
marginBottom: '.5rem',
color: '#3f7ef8'
},
children: "\u771F\u5B9E\u6848\u4F8B"
}), /*#__PURE__*/_jsx("h1", {
style: {
fontSize: '3rem',
lineHeight: 1,
letterSpacing: 0,
fontWeight: 900,
marginBottom: '1rem'
},
children: "\u5DF2\u8D62\u5F97\u5343\u4F59\u7528\u6237\u7684\u4FE1\u8D56"
})]
}), /*#__PURE__*/_jsxs(Col, {
span: 10,
offset: 4,
children: [/*#__PURE__*/_jsx("p", {
style: {
lineHeight: 1.625,
fontSize: '1rem',
marginBottom: '1rem',
marginTop: '1rem'
},
children: "\u4ECE\u4E2A\u4EBA\u5F00\u6E90\u5F00\u53D1\u8005\uFF0C\u5230\u6EF4\u6EF4\u3001\u7F8E\u56E2\u8FD9\u6837\u91CF\u7EA7\u7684\u516C\u53F8\uFF0C\u6211\u4EEC\u5DF2\u7ECF\u770B\u5230 LogicFlow \u88AB\u5E94\u7528\u4E8E\u4F4E\u4EE3\u7801\u9875\u9762\u903B\u8F91\u7F16\u6392\u3001\u95EE\u5377\u8DF3\u8F6C\u903B\u8F91\u914D\u7F6E\u3001\u6BD4\u8D5B\u7ED3\u679C\u9884\u6D4B\u5A31\u4E50\u5E94\u7528\u4EE5\u53CA\u673A\u5668\u5B66\u4E60\u6570\u636E\u5904\u7406\u6D41\u7A0B\u7B49\u5404\u79CD\u573A\u666F\u3002"
}), /*#__PURE__*/_jsx(Button, {
href: "/examples",
children: "\u67E5\u770B\u66F4\u591A\u6848\u4F8B"
})]
})]
}), /*#__PURE__*/_jsxs(Swiper, {
autoplay: {
delay: 2500,
disableOnInteraction: false
},
speed: 600,
parallax: true,
pagination: {
clickable: true,
type: 'progressbar'
},
navigation: true,
modules: [Autoplay, Parallax, Pagination, Navigation],
className: "mySwiper",
spaceBetween: 30,
centeredSlides: true
// onAutoplayTimeLeft={onAutoplayTimeLeft}
,
grabCursor: true,
effect: 'creative',
creativeEffect: {
prev: {
shadow: true,
translate: [0, 0, -400]
},
next: {
translate: ['100%', 0, 0]
}
},
children: [/*#__PURE__*/_jsx("div", {
slot: "container-start",
className: "parallax-bg",
style: {
backgroundColor: '#1c1826'
},
"data-swiper-parallax": "-23%"
}), map(swiperData, function (data) {
return /*#__PURE__*/_jsx(SwiperSlide, {
children: /*#__PURE__*/_jsxs("div", {
className: "swiper-slide-wrapper",
children: [/*#__PURE__*/_jsxs("div", {
children: [/*#__PURE__*/_jsx("div", {
className: "title",
"data-swiper-parallax": "-300",
children: data.title
}), /*#__PURE__*/_jsx("div", {
className: "subtitle",
"data-swiper-parallax": "-200",
children: data.subtitle
}), /*#__PURE__*/_jsx("div", {
className: "text",
"data-swiper-parallax": "-100",
children: /*#__PURE__*/_jsx("p", {
children: data.desc
})
})]
}), /*#__PURE__*/_jsx("img", {
style: {
height: '400px'
},
src: data.img,
alt: data.alt
})]
})
}, data.title);
})]
})]
});
}