@soul-refiner/design-system 2.14.82 → 2.14.84
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,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";var e=require("react/jsx-runtime"),t=require("react"),i=require("next/image"),r=require("next/link"),n=require("styled-components"),o=require("react-show-more-text"),l=require("../../../common/regex.js"),s=require("../../atoms/box/box.js"),a=require("../../atoms/highlighter/highlighter.js"),d=require("../../atoms/typography/heading.js"),h=require("../../atoms/typography/paragraph.js"),c=require("../modal/modal.js");require("../../atoms/typography/display.js"),require("../../atoms/typography/typography.js");var
|
|
2
|
+
"use strict";var e=require("react/jsx-runtime"),t=require("react"),i=require("next/image"),r=require("next/link"),n=require("styled-components"),o=require("react-show-more-text"),l=require("../../../common/regex.js"),s=require("../../atoms/box/box.js"),a=require("../../atoms/highlighter/highlighter.js"),d=require("../../atoms/typography/heading.js"),h=require("../../atoms/typography/paragraph.js"),c=require("../modal/modal.js");require("../../atoms/typography/display.js"),require("../../atoms/typography/typography.js");var p=require("../../atoms/time_ago/time_ago.js"),x=require("../../iconography/avatar/avatar.js"),u=require("../../../icons/security/lock.js"),g=require("../../../icons/arrow/chevron_left.js"),m=require("../../../icons/arrow/chevron_right.js"),f=require("../../media/video/video.js");function y(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var v=y(t),w=y(i),j=y(r),b=y(o);const $=n.styled.div`
|
|
3
3
|
position: relative;
|
|
4
4
|
max-width: 700px;
|
|
5
5
|
width: 100%;
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
position: relative;
|
|
66
66
|
width: 100%;
|
|
67
67
|
height: 480px;
|
|
68
|
-
`,
|
|
68
|
+
`,H=n.styled.div`
|
|
69
69
|
position: relative;
|
|
70
70
|
display: flex;
|
|
71
71
|
flex-direction: column;
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
justify-content: center;
|
|
76
76
|
gap: 16px;
|
|
77
77
|
overflow: hidden;
|
|
78
|
-
`,
|
|
78
|
+
`,P=n.styled.div`
|
|
79
79
|
display: flex;
|
|
80
80
|
justify-content: space-around;
|
|
81
81
|
align-items: center;
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
display: flex;
|
|
86
86
|
flex-flow: column nowrap;
|
|
87
87
|
gap: 24px;
|
|
88
|
-
`,
|
|
88
|
+
`,E=n.styled.button`
|
|
89
89
|
width: 48px;
|
|
90
90
|
height: 150px;
|
|
91
91
|
display: flex;
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
&:hover {
|
|
102
102
|
background-color: rgba(0, 0, 0, 0.2);
|
|
103
103
|
}
|
|
104
|
-
`,
|
|
104
|
+
`,L=n.styled.div`
|
|
105
105
|
margin-top: 24px;
|
|
106
106
|
border-radius: 32px;
|
|
107
107
|
border: 1px solid var(--color-grey-8);
|
|
@@ -109,4 +109,4 @@
|
|
|
109
109
|
padding: 6px 16px;
|
|
110
110
|
width: fit-content;
|
|
111
111
|
cursor: pointer;
|
|
112
|
-
`;exports.Post=({actions:t,author:i,authorActive:r,authorHref:n,authorImage:o,avatarTooltipContent:y,avatarTooltipSx:
|
|
112
|
+
`;exports.Post=({actions:t,author:i,authorActive:r,authorHref:n,authorImage:o,avatarTooltipContent:y,avatarTooltipSx:R,children:M,content:U,createdDate:_,dropdown:I,hasComments:A,id:B,images:F,isPaidUser:T,isPaywalled:W=!1,link:J,video:D,onJoin:X,monthlyMembershipPrice:G,onImageClick:V})=>{const N=v.default.useId(),O=v.default.useRef(null),[Y,K]=v.default.useState(!1),[Q,Z]=v.default.useState(-1),[ee,te]=v.default.useState(!1),ie=v.default.useRef(null),[re,ne]=v.default.useState(-1),[oe,le]=v.default.useState({x:"30vw",y:"30vh"}),se=!!D?.url&&!!D?.thumbnail,ae=D?.displayHtmlVideo;v.default.useEffect(()=>{if(O.current&&U?.length>0){const e=24,t=Math.ceil(O.current.offsetHeight/e);if(Z(t),!Y)try{const t=O.current.style.webkitLineClamp;O.current.style.webkitLineClamp="none";const i=O.current.offsetHeight,r=Math.ceil(i/e);O.current.style.webkitLineClamp=t,te(r>3)}catch(e){te(t>=3)}}else Z(-1),te(!1)},[U,Y]),v.default.useEffect(()=>{const e=e=>{"ArrowLeft"===e.key?pe():"ArrowRight"===e.key?ce():"Escape"!==e.key&&"Enter"!==e.key||ne(-1)};return"undefined"!=typeof document&&F?.length&&re>-1&&document.addEventListener("keydown",e),()=>{F?.length&&document.removeEventListener("keydown",e)}},[]);const de=v.default.Children.toArray(t),he=v.default.Children.toArray(M),ce=()=>{ne(e=>F?.length&&e!==F.length-1?e+1:e)},pe=()=>{ne(e=>F?.length&&0!==e?e-1:e)};return e.jsxs($,{id:B,children:[re>-1&&!!F?.[re]&&e.jsx(c.Modal,{alwaysRender:!1,controlledOpen:!0,onChange:e=>!e&&ne(-1),children:e.jsxs(c.Modal.Content,{sx:`\n position: relative; \n height: ${oe.y}; \n width: ${oe.x};\n margin: 0 auto;\n `,children:[e.jsx(E,{$side:"left",$visible:0!==re,onClick:pe,children:e.jsx(g.ChevronLeft,{color:"white",size:48})}),e.jsx(w.default,{alt:"",fill:!0,quality:100,onLoad:e=>{const{naturalHeight:t,naturalWidth:i}=e.target;let r=`${i}px`,n=`${t}px`;window?.innerHeight<t&&window?.innerWidth<i?(r=`${Math.floor(.95*window.innerHeight*i/t)}px`,n=`${Math.round(.95*window.innerWidth*t/i)}px`):window?.innerHeight<t?(r=`${Math.floor(.95*window.innerHeight*i/t)}px`,n="95vh"):window?.innerWidth<i&&(r="95vw",n=`${Math.round(.95*window.innerWidth*t/i)}px`),le({x:r,y:n})},draggable:!1,priority:!0,sizes:"100vw",src:F[re],style:{objectFit:"cover"}}),e.jsx(E,{$side:"right",$visible:re!==F.length-1,onClick:ce,children:e.jsx(m.ChevronRight,{color:"white",size:48})})]})}),e.jsxs(k,{children:[e.jsx(x.Avatar,{isPaidUser:T,as:n?j.default:"button",href:n,image:o,size:64,status:r?"online":void 0,subtitle:e.jsx(h.P,{as:"span",sx:"vertical-align: top;",$fontSize:14,$lineHeight:20,children:e.jsx(p.TimeAgo,{date:new Date(_)})}),title:e.jsx(d.H,{as:n?j.default:"span",href:n,sx:"text-decoration:none;",$bold:!0,$fontSize:18,$lineHeight:26,children:i}),textPosition:"right",tooltipContent:y,tooltipSx:R,sx:n?"img { cursor: pointer; }":void 0}),I]}),!!U?.length&&e.jsxs("div",{style:{padding:"16px 24px"},children:[W&&Q>1?e.jsx(b.default,{lines:2,more:"Continue Reading",onClick:X,anchorClass:"see-more",expanded:!1,truncatedEndingComponent:"... ",children:e.jsx(h.P,{$sx:"white-space: pre-line; word-break: break-word;",$textClampLines:2,children:e.jsx(a.Highlighter,{highlightRender:t=>e.jsx(h.P,{as:"span",$color:"primary-blue-2",children:e.jsx(j.default,{href:t,target:"_blank",children:t})}),seperator:l.URL_REGEX,text:U})})}):e.jsxs(e.Fragment,{children:[e.jsx(h.P,{$sx:"white-space: pre-line; word-break: break-word;",innerRef:O,$textClampLines:Y?void 0:5,children:e.jsx(a.Highlighter,{highlightRender:t=>e.jsx(h.P,{as:"span",$color:"primary-blue-2",children:e.jsx(j.default,{href:t,target:"_blank",children:t})}),seperator:l.URL_REGEX,text:W&&1===Q?"This is a premium post. Join to the membership to unlock the full access.":U})}),ee&&!W?e.jsx(h.P,{$color:"grey-5",sx:"cursor:pointer;",$mediumBold:!0,$fontSize:14,onClick:()=>K(e=>!e),children:Y?"See less":"See more"}):null]}),W&&!F?.length&&e.jsx(L,{onClick:X,children:e.jsxs(h.P,{$fontSize:14,$mediumBold:!0,children:["Join now for $",G," per month"]})})]}),W&&!!F?.length&&!se&&e.jsxs(H,{children:[e.jsx(w.default,{alt:"",width:650,height:427,priority:!0,quality:100,src:F[0],style:{objectFit:"fill",height:"100%",width:"100%",filter:"blur(60px)",position:"absolute",top:0,left:"50%",transform:"translateX(-50%)"}}),e.jsx(u.Lock,{size:40,color:"white",sx:"z-index: 1"}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",zIndex:1},children:[e.jsx(h.P,{$color:"white",$fontSize:14,$bold:!0,$lineHeight:20,children:"Become a member"}),e.jsx(h.P,{$color:"white",$fontSize:14,$bold:!0,$lineHeight:20,children:"to unlock this post"})]}),e.jsx(L,{onClick:X,style:{zIndex:1,marginTop:0},children:e.jsxs(h.P,{$fontSize:14,$mediumBold:!0,children:["Join now for $",G," per month"]})})]}),!!F?.length&&!se&&!W&&e.jsxs(C,{$numImages:F.length,children:[F.slice(0,4).map((t,i)=>e.jsx(q,{children:e.jsx(w.default,{alt:"",fill:!0,onClick:()=>{V?.(i),ne(i)},quality:100,src:t,draggable:!1,style:{cursor:"pointer",objectFit:"cover"}})},`${N}${t.slice(0,15)}${i}`)),F.length>4&&e.jsxs(d.H,{as:"p",className:"more-than",sx:"pointer-events: none;",$color:"grey-10",$fontSize:28,$lineHeight:36,$semiBold:!0,children:["+",F.length-4]})]}),!F?.length&&!se&&J&&!W&&e.jsxs(j.default,{href:J.url,target:"_blank",children:[e.jsx(q,{children:e.jsx(w.default,{alt:"",fill:!0,quality:100,src:J.imageUrl,draggable:!1,style:{cursor:"pointer",objectFit:"cover"}})}),e.jsxs(s.Box,{$dir:"column",$gap:8,sx:"padding: 8px 16px;",children:[e.jsx(h.P,{$color:"grey-2",$semiBold:!0,children:J.title}),e.jsx(h.P,{$color:"grey-5",children:J.description})]})]}),se&&e.jsx(z,{children:ae?e.jsxs("video",{ref:ie,style:{width:"100%",height:"100%"},controls:!0,playsInline:!0,poster:D.thumbnail,children:[D.videoUrls.webm&&e.jsx("source",{src:D.videoUrls.webm,type:"video/webm; codecs=vp9"}),D.videoUrls.mp4&&e.jsx("source",{src:D.videoUrls.mp4,type:"video/mp4; codecs=avc1.42E01E"}),"Your browser does not support the video tag."]}):e.jsx(f.Video,{src:D.url,thumbnail:D.thumbnail,subtitles:[],title:D?.title})}),!!de.length&&e.jsx(P,{children:!W&&de}),A&&!!he.length&&e.jsx(S,{children:he})]})};
|
|
@@ -25,6 +25,11 @@ export interface PostProps extends React.PropsWithChildren {
|
|
|
25
25
|
url: string;
|
|
26
26
|
thumbnail: string;
|
|
27
27
|
title?: string;
|
|
28
|
+
videoUrls: {
|
|
29
|
+
webm?: string;
|
|
30
|
+
mp4?: string;
|
|
31
|
+
};
|
|
32
|
+
displayHtmlVideo?: boolean;
|
|
28
33
|
};
|
|
29
34
|
onJoin?: () => void;
|
|
30
35
|
monthlyMembershipPrice?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"post.d.ts","sourceRoot":"","sources":["../../../../../src/components/surfaces/post/post.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAkB1B,MAAM,WAAW,SAAU,SAAQ,KAAK,CAAC,iBAAiB;IACxD,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,oBAAoB,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC;IAC1C,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC;IAC9B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,IAAI,CAAC,EAAE;QACL,WAAW,EAAE,MAAM,CAAC;QACpB,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,CAAC;QACjB,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;IACF,KAAK,CAAC,EA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