@soul-refiner/design-system 0.2.71 → 0.2.73

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.
@@ -18,7 +18,7 @@ export const TextArea = ({ bg = 'var(--color-blue-10)', disabled, helperText, ic
18
18
  icon,
19
19
  React.createElement(TextAreaElement, { disabled: disabled, name: name, onChange: onChange, placeholder: placeholder, ref: ref, value: maxCharacters
20
20
  ? value.slice(0, maxCharacters - 1)
21
- : value, "$resize": resize }),
21
+ : value, "$minHeight": minHeight, "$resize": resize }),
22
22
  successful && React.createElement(CheckmarkCircle, { color: "green-3" }),
23
23
  warning && React.createElement(AlertCircle, { color: "red-4" })),
24
24
  React.createElement(Box, { "$gap": 16, "$justify": "space-between" },
@@ -75,6 +75,7 @@ const InputWrapper = styled.div `
75
75
  ${({ $warning }) => $warning ? 'border-color: var(--color-red-4) !important;' : ''}
76
76
  `;
77
77
  const TextAreaElement = styled.textarea `
78
+ min-width: ${({ $minHeight }) => ($minHeight ? $minHeight - 24 + 'px;' : '')}
78
79
  padding: 0px;
79
80
  flex: 1;
80
81
  font-family: var(--font-inter);
@@ -7,8 +7,11 @@ export interface PostProps extends React.PropsWithChildren {
7
7
  authorImage: string;
8
8
  content: string;
9
9
  createdDate: string;
10
+ dropdown?: React.ReactElement;
10
11
  hasComments?: boolean;
11
12
  id?: string;
12
13
  images?: string[];
14
+ isPaywalled?: boolean;
15
+ onJoin?: () => void;
13
16
  }
14
- export declare const Post: ({ actions, author, authorActive, authorHref, authorImage, children, content, createdDate, hasComments, images, }: PostProps) => React.JSX.Element;
17
+ export declare const Post: ({ actions, author, authorActive, authorHref, authorImage, children, content, createdDate, dropdown, hasComments, id, images, isPaywalled, onJoin, }: PostProps) => React.JSX.Element;
@@ -1,27 +1,40 @@
1
1
  'use client';
2
2
  import React from 'react';
3
3
  import styled from 'styled-components';
4
- import { Avatar, H, P } from '../../';
4
+ import { H, P } from '../../atoms/typography';
5
+ import { Button } from '../../actions/button';
6
+ import { Avatar } from '../../iconography/avatar';
7
+ import { Lock } from '../../../icons';
5
8
  import { abbrTimeBeforeDate } from './helpers';
6
- export const Post = ({ actions, author, authorActive, authorHref, authorImage, children, content, createdDate, hasComments, images, }) => {
7
- const id = React.useId();
9
+ export const Post = ({ actions, author, authorActive, authorHref, authorImage, children, content, createdDate, dropdown, hasComments, id, images, isPaywalled = false, onJoin, }) => {
10
+ const componentId = React.useId();
8
11
  const _actions = React.Children.toArray(actions);
9
12
  const _comments = React.Children.toArray(children);
10
13
  const subtitle = abbrTimeBeforeDate(new Date(createdDate));
11
14
  return (React.createElement(Wrapper, { id: id },
12
15
  React.createElement(Header, null,
13
- React.createElement(Avatar, { href: authorHref, image: authorImage, size: 64, status: authorActive ? 'online' : undefined, subtitle: React.createElement(P, { as: "span", sx: "vertical-align: top;", "$fontSize": 14, "$lineHeight": 20 }, subtitle), title: React.createElement(H, { as: "span", "$bold": true, "$fontSize": 18, "$lineHeight": 26 }, author), textPosition: "right" })),
14
- React.createElement(P, { "$sx": "padding: 24px;" }, content),
15
- !!images?.length && (React.createElement(ImagesWrapper, { "$numImages": images.length },
16
- images.slice(0, 4).map((url, i) => (React.createElement(ImageWrapper, { key: `${id}${url.slice(0, 15)}${i}` },
16
+ React.createElement(Avatar, { href: authorHref, image: authorImage, size: 64, status: authorActive ? 'online' : undefined, subtitle: React.createElement(P, { as: "span", sx: "vertical-align: top;", "$fontSize": 14, "$lineHeight": 20 }, subtitle), title: React.createElement(H, { as: "span", "$bold": true, "$fontSize": 18, "$lineHeight": 26 }, author), textPosition: "right" }),
17
+ dropdown),
18
+ !!content?.length && (React.createElement("div", { style: { padding: 24 } },
19
+ React.createElement(P, { "$textClampLines": isPaywalled ? 2 : undefined }, content))),
20
+ !!images?.length && (React.createElement(ImagesWrapper, { "$numImages": images.length, "$isPaywalled": isPaywalled },
21
+ images.slice(0, 4).map((url, i) => (React.createElement(ImageWrapper, { key: `${componentId}${url.slice(0, 15)}${i}` },
17
22
  React.createElement("img", { src: url, alt: "" })))),
18
23
  images.length > 4 && (React.createElement(H, { as: "p", className: "more-than", "$color": "grey-10", "$fontSize": 28, "$lineHeight": 36, "$semiBold": true },
19
24
  "+",
20
25
  images.length - 4)))),
21
- !!_actions.length && React.createElement(ActionsWrapper, null, _actions),
26
+ !!images?.length && isPaywalled && (React.createElement(PaywallWrapper, null,
27
+ React.createElement(Lock, { size: 40, color: "grey-7" }),
28
+ React.createElement(P, { "$fontSize": 14, "$bold": true, "$lineHeight": 20, "$color": "white" },
29
+ "Become a member",
30
+ React.createElement("br", null),
31
+ "to unlock this post"),
32
+ React.createElement(Button, { onClick: onJoin, size: "small", sx: "width: 213px;", type: "outlined" }, "Join now"))),
33
+ !!_actions.length && (React.createElement(ActionsWrapper, null, !isPaywalled && _actions)),
22
34
  hasComments && !!_comments.length && (React.createElement(CommentWrapper, null, _comments))));
23
35
  };
24
36
  const Wrapper = styled.div `
37
+ position: relative;
25
38
  max-width: 700px;
26
39
  width: 100%;
27
40
  background-color: var(--color-white);
@@ -78,6 +91,13 @@ const ImagesWrapper = styled.div `
78
91
  height: 100%;
79
92
  }
80
93
  `}
94
+
95
+ ${({ $isPaywalled }) => $isPaywalled
96
+ ? /** TODO REMOVE USER CAN CHANGE -> SECURITY */
97
+ `
98
+ filter: blur(10px) brightness(0.6);
99
+ clip-path: inset(0px 0px 0px 0px);`
100
+ : ''}
81
101
  `;
82
102
  const ImageWrapper = styled.div `
83
103
  position: relative;
@@ -85,12 +105,20 @@ const ImageWrapper = styled.div `
85
105
  flex: 1;
86
106
  min-width: min(227px, 80vw);
87
107
  `;
108
+ const PaywallWrapper = styled.div `
109
+ position: absolute;
110
+ display: flex;
111
+ flex-direction: column;
112
+ gap: 16px;
113
+ align-items: center;
114
+ top: 310px;
115
+ left: 242px;
116
+ `;
88
117
  const ActionsWrapper = styled.div `
89
118
  display: flex;
90
119
  justify-content: space-around;
91
120
  align-items: center;
92
121
  padding: 24px;
93
- border-bottom: 1px solid var(--color-grey-9);
94
122
  `;
95
123
  const CommentWrapper = styled.div `
96
124
  padding: 24px;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soul-refiner/design-system",
3
- "version": "0.2.71",
3
+ "version": "0.2.73",
4
4
  "main": "dist/index.js",
5
5
  "license": "MIT",
6
6
  "publishConfig": {