UNPKG

@lobehub/ui

Version:

Lobe UI is an open-source UI component library for building AIGC web apps

41 lines 3.27 kB
var _excluded = ["children"]; var _templateObject; function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); } import { createStyles } from 'antd-style'; import { useMemo } from 'react'; import SearchResultCards from "../../SearchResultCards"; import { jsx as _jsx } from "react/jsx-runtime"; var useStyles = createStyles(function (_ref) { var css = _ref.css, token = _ref.token; return { fallback: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding-block: 1em;\n font-size: 0.875em;\n color: ", ";\n\n ol {\n display: flex;\n flex-wrap: wrap;\n gap: 0.5em;\n\n margin: 0;\n padding: 0;\n\n list-style-type: none;\n }\n\n ol li {\n position: relative;\n\n overflow: hidden;\n display: flex;\n flex-direction: row;\n\n margin: 0 !important;\n padding-block: 0 !important;\n padding-inline: 0 0.4em !important;\n border: 1px solid ", ";\n border-radius: 0.25em;\n\n text-overflow: ellipsis;\n white-space: nowrap;\n\n &::before {\n content: counter(list-item);\n counter-increment: list-item;\n\n display: block;\n\n margin-inline-end: 0.4em;\n padding-inline: 0.6em;\n\n background: ", ";\n }\n\n p,\n a {\n overflow: hidden;\n\n margin: 0 !important;\n padding: 0 !important;\n\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n }\n "])), token.colorTextSecondary, token.colorBorderSecondary, token.colorFillSecondary) }; }); var Footnotes = function Footnotes(_ref2) { var children = _ref2.children, res = _objectWithoutProperties(_ref2, _excluded); var _useStyles = useStyles(), styles = _useStyles.styles, cx = _useStyles.cx; var links = useMemo(function () { try { return JSON.parse(res['data-footnote-links'] || ''); } catch (error) { console.error(error); console.log(res); return []; } }, [res['data-footnote-links']]); var isError = links.length === 0; return /*#__PURE__*/_jsx("section", { className: cx('footnotes', isError && styles.fallback), "data-footnotes": "true", children: isError ? children : /*#__PURE__*/_jsx(SearchResultCards, { dataSource: links }) }); }; export default Footnotes;