UNPKG

alinea

Version:
76 lines (72 loc) 3.38 kB
import { dist_default } from "../../../chunks/chunk-A5O3N2GS.js"; import "../../../chunks/chunk-NZLE2WMY.js"; // src/dashboard/view/entry/EntrySummary.tsx import { Type } from "alinea/core/Type"; import { Chip, HStack, px, TextLabel, Typo, VStack } from "alinea/ui"; import { Ellipsis } from "alinea/ui/Ellipsis"; import { IcRoundKeyboardArrowRight } from "alinea/ui/icons/IcRoundKeyboardArrowRight"; import { Fragment } from "react"; import { useDashboard } from "../../hook/UseDashboard.js"; import { useNav } from "../../hook/UseNav.js"; // src/dashboard/view/entry/EntrySummary.module.scss var EntrySummary_module_default = { "row": "alinea-EntrySummary-row", "thumb": "alinea-EntrySummary-thumb", "thumb-header": "alinea-EntrySummary-thumb-header", "thumbHeader": "alinea-EntrySummary-thumb-header", "thumb-title": "alinea-EntrySummary-thumb-title", "thumbTitle": "alinea-EntrySummary-thumb-title", "thumb-footer": "alinea-EntrySummary-thumb-footer", "thumbFooter": "alinea-EntrySummary-thumb-footer" }; // src/dashboard/view/entry/EntrySummary.tsx import { jsx, jsxs } from "react/jsx-runtime"; var styles = dist_default(EntrySummary_module_default); function EntrySummaryRow({ id, title, path, url, type: typeName, parents }) { const nav = useNav(); const { schema } = useDashboard().config; const type = schema[typeName]; if (!type) return null; return /* @__PURE__ */ jsxs(HStack, { center: true, full: true, gap: 10, className: styles.row(), children: [ /* @__PURE__ */ jsxs(VStack, { children: [ parents.length > 0 && /* @__PURE__ */ jsx(Ellipsis, { style: { marginTop: px(-1) }, children: /* @__PURE__ */ jsx(Typo.Small, { children: /* @__PURE__ */ jsx(HStack, { center: true, gap: 3, title: url, children: parents.map(({ id: id2, title: title2 }) => /* @__PURE__ */ jsx(Fragment, { children: title2 }, id2)).reduce((prev, curr, i) => [ prev, /* @__PURE__ */ jsx(IcRoundKeyboardArrowRight, {}, `s${i}`), curr ]) }) }) }), /* @__PURE__ */ jsx(Ellipsis, { children: /* @__PURE__ */ jsx(TextLabel, { label: title, title }) }) ] }), /* @__PURE__ */ jsx(Chip, { style: { marginLeft: "auto" }, children: /* @__PURE__ */ jsx(TextLabel, { label: Type.label(type), title: Type.label(type) }) }) ] }); } function EntrySummaryThumb({ id, title, type: typeName, parents }) { const { schema } = useDashboard().config; const type = schema[typeName]; return /* @__PURE__ */ jsxs("div", { className: styles.thumb(), children: [ parents.length > 0 && /* @__PURE__ */ jsx("header", { className: styles.thumb.header(), children: /* @__PURE__ */ jsx(Typo.Small, { children: /* @__PURE__ */ jsx(HStack, { center: true, gap: 3, children: parents.map(({ id: id2, title: title2 }) => /* @__PURE__ */ jsx(Fragment, { children: title2 }, id2)).reduce((prev, curr, i) => [ prev, /* @__PURE__ */ jsx(IcRoundKeyboardArrowRight, {}, `s${i}`), curr ]) }) }) }), /* @__PURE__ */ jsx("div", { className: styles.thumb.title(), children: /* @__PURE__ */ jsx(TextLabel, { label: title }) }), /* @__PURE__ */ jsx("div", { className: styles.thumb.footer(), children: /* @__PURE__ */ jsx(Chip, { style: { marginLeft: "auto" }, children: /* @__PURE__ */ jsx(TextLabel, { label: Type.label(type) }) }) }) ] }); } export { EntrySummaryRow, EntrySummaryThumb };