UNPKG

@devgateway/dvz-ui-react

Version:

A modular, embeddable React component library for data visualization and UI, built with TypeScript. Provides reusable components for charts, maps, dashboards, and more, with built-in support for internationalization and Redux integration.

74 lines (73 loc) 3.42 kB
import { jsx as e, jsxs as o } from "react/jsx-runtime"; import { Menu as n, Image as p, Popup as f } from "semantic-ui-react"; import { useState as I } from "react"; import { MenuProvider as N, MediaProvider as v, MediaConsumer as w, MenuConsumer as u } from "@devgateway/wp-react-lib"; import { injectIntl as _ } from "react-intl"; import x from "./SearchControl.js"; import M from "./LangSwitcher.js"; import { useParams as S } from "react-router"; const g = (r, i) => r ? r.substr(r.indexOf("/wp") + 3).startsWith("/" + i) ? r.substr(r.indexOf("/wp") + 3) : "/" + i + r.substr(r.indexOf("/wp") + 3) : "", b = (r) => { const { settings: i, withIcons: m, active: a, menu: d, onSetSelected: c, selected: s, locale: h } = r; return d.items.filter((t) => t.url != "#wpm-languages").map((t) => /* @__PURE__ */ o( n.Item, { className: `divided ${t.child_items ? "has-child-items" : ""} ${s && s.ID == t.ID ? "selected" : ""} ${a == t.slug ? "active" : ""}`, children: [ !t.child_items && /* @__PURE__ */ e("a", { onClick: (l) => c(t), href: g(t.url, h), children: t.title }), t.child_items && /* @__PURE__ */ e( f, { position: "top center", className: "floating child", positionFixed: !0, hoverable: !0, trigger: /* @__PURE__ */ e("span", { children: t.title }), children: t.child_items.map((l) => /* @__PURE__ */ o(n.Item, { children: [ l.icon && /* @__PURE__ */ e("img", { className: "child icon", src: l.icon.url }), /* @__PURE__ */ o("span", { children: [ " ", /* @__PURE__ */ e("a", { onClick: (P) => c(t), href: g(l.url, h), children: l.title }) ] }) ] })) } ) ] } )); }, C = ({ intl: { locale: r }, settings: i }) => { const [m, a] = I(), { slug: d } = S(), c = ({ media: s }) => s ? /* @__PURE__ */ e(p, { src: s.guid.rendered }) : /* @__PURE__ */ e("img", { className: "brand logo", size: "large", src: "/logo_full.png" }); return /* @__PURE__ */ e(N, { slug: "main", locale: r, children: /* @__PURE__ */ o(n, { className: "header floating branding", text: !0, children: [ /* @__PURE__ */ e(n.Item, { className: "logo", children: /* @__PURE__ */ o("a", { href: `/${r}`, children: [ i.site_logo != 0 && /* @__PURE__ */ e(v, { id: i.site_logo, children: /* @__PURE__ */ e(w, { children: /* @__PURE__ */ e(c, {}) }) }), !window.isCustomizedPreview && i.site_logo == 0 && /* @__PURE__ */ e("img", { className: "brand logo", size: "large", src: "/dc-logo_01.png" }) ] }) }), /* @__PURE__ */ e(n.Item, { className: "divider", children: /* @__PURE__ */ e("div", {}) }), /* @__PURE__ */ e(n.Item, { className: "site name", fitted: !0, href: "/", children: i.name }), /* @__PURE__ */ e(n.Item, { className: "pages", children: /* @__PURE__ */ e(u, { children: /* @__PURE__ */ e( b, { settings: i, active: d, selected: m, onSetSelected: a, locale: r } ) }) }), /* @__PURE__ */ e(n.Item, { className: "lang switcher", children: /* @__PURE__ */ e(u, { children: /* @__PURE__ */ e(M, { locale: r }) }) }), /* @__PURE__ */ e(n.Item, { fitted: !0, children: /* @__PURE__ */ e(x, {}) }) ] }) }); }, L = _(C); export { L as default };