quirk-ui 0.0.516 → 0.0.517
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../../assets/index22.css');const e=require("react/jsx-runtime"),l=require("react"),p=require("../../ui/PortableTextRenderer/index.cjs"),g=require("../../../core/components/Modal/index.cjs"),S=require("next/image"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('../../../assets/index22.css');const e=require("react/jsx-runtime"),l=require("react"),p=require("../../ui/PortableTextRenderer/index.cjs"),g=require("../../../core/components/Modal/index.cjs"),S=require("next/image"),f=require("../../utils/resolveLinkUrl.cjs"),F=require("../../hooks/useMediaQuery.cjs"),s=require("../../../index-CBK5rp6X.cjs"),L="_cardLink_1wi59_1",N="_card_1wi59_1",q="_container_1wi59_18",M="_image_1wi59_28",R="_rating_1wi59_43",U="_ratingValue_1wi59_49",O="_ratingOuter_1wi59_54",C="_ratingInner_1wi59_61",t={cardLink:L,card:N,container:q,image:M,rating:R,ratingValue:U,ratingOuter:O,ratingInner:C};function I({variant:v,description:u,rating:d,image:n,callToAction:r,onHover:c,onLeave:h,gridArea:x}){const[_,w]=l.useState(void 0);l.useEffect(()=>{async function a(){if((r==null?void 0:r.type)==="link"||(r==null?void 0:r.type)==="download"){const i=await f.resolveLinkURL(r);w(i)}}a()},[r]);const k=F.useMediaQuery("(max-width: 768px)"),y=e.jsx(e.Fragment,{children:n&&n.imageUrl?e.jsx("div",{className:t.image,children:e.jsx(S,{src:n.imageUrl,alt:(n==null?void 0:n.asset.altText)||(n==null?void 0:n.asset.description)||"Card image",width:600,height:658,priority:!1})}):null}),b=()=>{const a=Number(d)/5*100;return e.jsxs("div",{className:t.ratingOuter,children:[e.jsx(s.FaStar,{}),e.jsx(s.FaStar,{}),e.jsx(s.FaStar,{}),e.jsx(s.FaStar,{}),e.jsx(s.FaStar,{}),e.jsxs("div",{className:t.ratingInner,style:{width:`${a}%`},children:[e.jsx(s.FaStar,{}),e.jsx(s.FaStar,{}),e.jsx(s.FaStar,{}),e.jsx(s.FaStar,{}),e.jsx(s.FaStar,{})]})]})},j=e.jsxs("div",{className:t.container,children:[y,e.jsx("div",{children:u&&e.jsx(p.RichText,{blocks:u})}),d&&e.jsxs("div",{className:t.rating,children:[b()," ",e.jsx("div",{className:t.ratingValue,children:d})]})]}),m=({children:a})=>{var i,o;switch(r==null?void 0:r.type){case"link":return e.jsx("a",{className:t.cardLink,"aria-label":r.ariaLabel||r.label,href:_,target:((i=r.linkOptions)==null?void 0:i.linkType)==="external"?"_blank":"_self",rel:((o=r.linkOptions)==null?void 0:o.linkType)==="external"?"noopener noreferrer":"",children:a});case"modal":return e.jsx(g.Modal,{trigger:a,content:r.modalContent});case"video":return e.jsx(g.Modal,{trigger:a,content:e.jsx("video",{src:r.videoUrl,controls:!0,autoPlay:!0})});case"download":return e.jsx("a",{className:t.cardLink,"aria-label":r.ariaLabel||r.label,href:_,download:!0,target:"_blank",rel:"noopener noreferrer",children:a})}};return e.jsx("div",{className:`${t.card} ${t[v]}`,onMouseEnter:c,onMouseLeave:h,style:x&&!k?{gridArea:x}:{},children:(r==null?void 0:r.type)!=="none"?e.jsx(m,{children:j}):e.jsx(e.Fragment,{children:j})})}exports.ReviewCard=I;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as r, Fragment as
|
|
1
|
+
import { jsx as r, Fragment as g, jsxs as d } from "react/jsx-runtime";
|
|
2
2
|
import { useState as x, useEffect as c } from "react";
|
|
3
3
|
import { RichText as U } from "../../ui/PortableTextRenderer/index.mjs";
|
|
4
4
|
import { Modal as h } from "../../../core/components/Modal/index.mjs";
|
|
@@ -40,14 +40,14 @@ function J({
|
|
|
40
40
|
}
|
|
41
41
|
a();
|
|
42
42
|
}, [e]);
|
|
43
|
-
const y = C("(max-width: 768px)"), b = /* @__PURE__ */ r(
|
|
43
|
+
const y = C("(max-width: 768px)"), b = /* @__PURE__ */ r(g, { children: s && s.imageUrl ? /* @__PURE__ */ r("div", { className: t.image, children: /* @__PURE__ */ r(
|
|
44
44
|
I,
|
|
45
45
|
{
|
|
46
46
|
src: s.imageUrl,
|
|
47
47
|
alt: (s == null ? void 0 : s.asset.altText) || (s == null ? void 0 : s.asset.description) || "Card image",
|
|
48
48
|
width: 600,
|
|
49
49
|
height: 658,
|
|
50
|
-
priority: !
|
|
50
|
+
priority: !1
|
|
51
51
|
}
|
|
52
52
|
) }) : null }), L = () => {
|
|
53
53
|
const a = Number(u) / 5 * 100;
|
|
@@ -74,7 +74,7 @@ function J({
|
|
|
74
74
|
/* @__PURE__ */ r("div", { className: t.ratingValue, children: u })
|
|
75
75
|
] })
|
|
76
76
|
] }), N = ({ children: a }) => {
|
|
77
|
-
var i,
|
|
77
|
+
var i, f;
|
|
78
78
|
switch (e == null ? void 0 : e.type) {
|
|
79
79
|
case "link":
|
|
80
80
|
return /* @__PURE__ */ r(
|
|
@@ -84,7 +84,7 @@ function J({
|
|
|
84
84
|
"aria-label": e.ariaLabel || e.label,
|
|
85
85
|
href: o,
|
|
86
86
|
target: ((i = e.linkOptions) == null ? void 0 : i.linkType) === "external" ? "_blank" : "_self",
|
|
87
|
-
rel: ((
|
|
87
|
+
rel: ((f = e.linkOptions) == null ? void 0 : f.linkType) === "external" ? "noopener noreferrer" : "",
|
|
88
88
|
children: a
|
|
89
89
|
}
|
|
90
90
|
);
|
|
@@ -120,7 +120,7 @@ function J({
|
|
|
120
120
|
onMouseEnter: w,
|
|
121
121
|
onMouseLeave: k,
|
|
122
122
|
style: _ && !y ? { gridArea: _ } : {},
|
|
123
|
-
children: (e == null ? void 0 : e.type) !== "none" ? /* @__PURE__ */ r(N, { children: p }) : /* @__PURE__ */ r(
|
|
123
|
+
children: (e == null ? void 0 : e.type) !== "none" ? /* @__PURE__ */ r(N, { children: p }) : /* @__PURE__ */ r(g, { children: p })
|
|
124
124
|
}
|
|
125
125
|
);
|
|
126
126
|
}
|