UNPKG

geoiq-frontend-ui-kit

Version:

This project is a UI kit for GeoIQ's frontend. It's built with React, TypeScript, and Vite.

173 lines (172 loc) 5.82 kB
import { Badge as y } from "./index8.es.js"; import w from "./index18.es.js"; import { Typography as d } from "./index19.es.js"; import { Dropdown as _ } from "./index22.es.js"; import { cn as f } from "./index88.es.js"; import e, { useState as S } from "react"; import { NavbarIconVariants as k } from "./index103.es.js"; import { AvatarDemo as A } from "./index6.es.js"; import { CreditSheet as I } from "./index104.es.js"; const O = ({ name: t = "", email: a = "" }) => { if (!(t || a)) return null; const r = "text-ellipsis overflow-hidden"; return /* @__PURE__ */ e.createElement("div", { className: "flex flex-col px-2" }, t && /* @__PURE__ */ e.createElement( d, { variant: "body4", className: f("text-light-1", r) }, t ), a && /* @__PURE__ */ e.createElement( d, { variant: "body5", className: f("text-light-3", r) }, a )); }, m = ({ alt: t, className: a, isActive: r = !1, isNew: l = !1, src: p, tooltipText: n = "", wrapper: E = null, onClick: i }) => { const c = (s) => E?.(s) ?? s, o = /* @__PURE__ */ e.createElement( "div", { className: f(k({ isActive: r }), a), ...i && { onClick: i } }, /* @__PURE__ */ e.createElement("img", { src: p, alt: t }), /* @__PURE__ */ e.createElement(D, { isNew: l }) ); return c( n ? /* @__PURE__ */ e.createElement("div", { className: "relative" }, /* @__PURE__ */ e.createElement( w, { content: "", headerText: /* @__PURE__ */ e.createElement("div", { className: "flex items-center gap-2" }, l && /* @__PURE__ */ e.createElement(y, { variant: "gradient", size: "sm" }, "NEW"), /* @__PURE__ */ e.createElement("div", null, n)), sideOffset: 24, triggerElement: o, delayDuration: 100, side: "right" } )) : o ); }, C = () => /* @__PURE__ */ e.createElement("div", { className: "my-1 h-[1px] w-10 bg-white opacity-20" }), D = ({ isNew: t }) => t ? /* @__PURE__ */ e.createElement("div", { className: "absolute w-[6px] h-[6px] rounded-full bottom-1 right-1 bg-secondary-2" }) : null, L = ({ src: t, popoverOptions: a, name: r = "", email: l = "" }) => /* @__PURE__ */ e.createElement( _, { dropdownContentProps: { sideOffset: 24, side: "right", align: "end" }, trigger: ( // div required as unable to open up the popup without it /* @__PURE__ */ e.createElement("div", null, /* @__PURE__ */ e.createElement( A, { imageSrc: t ?? "", size: "md", alt: "avatar", fallback: /* @__PURE__ */ e.createElement( "img", { src: "https://frontend-static-files.geoiq.io/strapi/Avatar_e5ab891e67.svg", alt: "avatar", className: "w-10 h-10 cursor-pointer" } ) } )) ), header: /* @__PURE__ */ e.createElement(O, { name: r, email: l }), optionGroups: a } ), q = ({ onClick: t }) => /* @__PURE__ */ e.createElement( d, { variant: "body4", className: "text-center text-white cursor-pointer", onClick: t }, "Login" ), P = ({ src: t, alt: a }) => /* @__PURE__ */ e.createElement("img", { src: t, alt: a, className: "w-10 h-auto" }), $ = ({ credits: t, onClick: a }) => t >= 0 && /* @__PURE__ */ e.createElement( "div", { className: "rounded brand-primary-secondary-gradient flex gap-[2px] h-auto box-border p-1 w-10 flex-wrap justify-center cursor-pointer", onClick: a }, t > 9999 ? /* @__PURE__ */ e.createElement( "img", { src: "https://frontend-static-files.geoiq.io/strapi/infinity_7d62ad2947.svg", alt: "infinity icon", className: "w-4 h-4" } ) : /* @__PURE__ */ e.createElement(d, { variant: "body5", className: "text-white" }, t), /* @__PURE__ */ e.createElement( "img", { src: "https://frontend-static-files.geoiq.io/strapi/navbar_credits_247858e26a.svg", alt: "coin icon", className: "w-4 h-4" } ) ), V = ({ login: t, icons: a, credits: r = -1, totalCredits: l = null, profile: p, clickDisable: n = !0, logo: E, className: i = "", id: c, onRequestCredits: o, onProceedToPayment: s, buyCreditsOptions: v, minimumCreditsToBuy: u, requestOnly: h }) => { const [x, g] = S(!1); return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement( "div", { className: f( "w-16 bg-dark-2 px-3 py-4 h-full flex flex-col justify-between", i ), id: c }, /* @__PURE__ */ e.createElement("div", { className: "flex flex-col items-center gap-8" }, /* @__PURE__ */ e.createElement(P, { ...E }), /* @__PURE__ */ e.createElement("div", { className: "flex flex-col gap-3" }, (a?.list ?? []).map((b, N) => /* @__PURE__ */ e.createElement(m, { key: N, ...b })))), /* @__PURE__ */ e.createElement("div", { className: "flex flex-col items-center gap-2" }, a.chat && /* @__PURE__ */ e.createElement(m, { ...a.chat }), a.notification && /* @__PURE__ */ e.createElement(m, { ...a.notification }), /* @__PURE__ */ e.createElement(m, { ...a.help }), /* @__PURE__ */ e.createElement($, { credits: r, onClick: () => g(!0) }), /* @__PURE__ */ e.createElement(C, null), t?.isLoggedIn ? /* @__PURE__ */ e.createElement(L, { ...p }) : /* @__PURE__ */ e.createElement(q, { ...t })) ), !n && /* @__PURE__ */ e.createElement( I, { open: x, onClose: () => g(!1), credit_details: l ? `Available: ${r}/${l}` : `Available: ${r}`, onRequestCredits: o, onProceedToPayment: s, containerId: "navbar-container", buyCreditsOptions: v, minimumCreditsToBuy: u, requestOnly: h } )); }; export { V as NavbarDesktop }; //# sourceMappingURL=index46.es.js.map