UNPKG

dumi-theme-antd-style

Version:

dumi-theme-antd-style 是为 dumi2 打造的一款文档站主题包,提供了更加美观、易用的研发与阅读体验

51 lines 1.73 kB
import { ArrowLeftOutlined, ArrowRightOutlined } from '@ant-design/icons'; import { Link, useIntl } from 'dumi'; import { memo, useMemo } from 'react'; import { Flexbox } from 'react-layout-kit'; import { useStyles } from "./Linker.style"; import { jsx as _jsx } from "react/jsx-runtime"; import { Fragment as _Fragment } from "react/jsx-runtime"; import { jsxs as _jsxs } from "react/jsx-runtime"; var Linker = function Linker(_ref) { var title = _ref.title, link = _ref.link, type = _ref.type; var _useStyles = useStyles(), styles = _useStyles.styles, cx = _useStyles.cx; var intl = useIntl(); var navContent = useMemo(function () { switch (type) { case 'prev': return /*#__PURE__*/_jsxs(_Fragment, { children: [/*#__PURE__*/_jsx(ArrowLeftOutlined, {}), " ", intl.formatMessage({ id: 'content.footer.actions.previous' })] }); case 'next': return /*#__PURE__*/_jsxs(_Fragment, { children: [intl.formatMessage({ id: 'content.footer.actions.next' }), " ", /*#__PURE__*/_jsx(ArrowRightOutlined, {})] }); } }, [type]); return /*#__PURE__*/_jsx(Link, { to: link, children: /*#__PURE__*/_jsxs(Flexbox, { className: styles.container, gap: 8, children: [/*#__PURE__*/_jsx(Flexbox, { horizontal: true, gap: 4, className: cx(styles.nav, type === 'next' && styles.alignmentEnd), children: navContent }), /*#__PURE__*/_jsx(Flexbox, { horizontal: true, className: cx(styles.title, type === 'next' && styles.alignmentEnd), children: title })] }) }); }; export default /*#__PURE__*/memo(Linker);