@soul-refiner/design-system 0.0.4 → 0.0.5

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.
Files changed (271) hide show
  1. package/.eslintrc.js +4 -0
  2. package/.turbo/turbo-build.log +12 -0
  3. package/.turbo/turbo-test.log +4417 -0
  4. package/CHANGELOG.md +7 -0
  5. package/babel.config.js +6 -0
  6. package/custom.d.ts +4 -0
  7. package/package.json +1 -9
  8. package/src/actions/Button/Button.module.scss +205 -0
  9. package/src/actions/Button/Button.spec.js +56 -0
  10. package/src/actions/Button/Button.tsx +143 -0
  11. package/src/actions/Button/index.ts +1 -0
  12. package/src/actions/Dropdown/Dropdown.module.scss +77 -0
  13. package/src/actions/Dropdown/Dropdown.spec.js +149 -0
  14. package/src/actions/Dropdown/Dropdown.tsx +224 -0
  15. package/src/actions/Dropdown/index.ts +6 -0
  16. package/src/actions/Dropzone/Dropzone.module.scss +48 -0
  17. package/src/actions/Dropzone/Dropzone.spec.js +60 -0
  18. package/src/actions/Dropzone/Dropzone.tsx +191 -0
  19. package/src/actions/Dropzone/index.ts +1 -0
  20. package/src/actions/Rate/Rate.module.scss +17 -0
  21. package/src/actions/Rate/Rate.tsx +53 -0
  22. package/src/actions/Rate/index.ts +1 -0
  23. package/src/actions/Switch/Switch.module.scss +35 -0
  24. package/src/actions/Switch/Switch.spec.js +31 -0
  25. package/src/actions/Switch/Switch.tsx +34 -0
  26. package/src/actions/Switch/index.ts +1 -0
  27. package/src/actions/index.ts +5 -0
  28. package/src/cards/CourseCard/CourseCard.module.scss +219 -0
  29. package/src/cards/CourseCard/CourseCard.spec.js +60 -0
  30. package/src/cards/CourseCard/CourseCard.tsx +145 -0
  31. package/src/cards/CourseCard/index.ts +1 -0
  32. package/src/cards/EpisodeCard/EpisodeCard.module.scss +69 -0
  33. package/src/cards/EpisodeCard/EpisodeCard.tsx +53 -0
  34. package/src/cards/EpisodeCard/index.ts +1 -0
  35. package/src/cards/FeatureCard/FeatureCard.module.scss +116 -0
  36. package/src/cards/FeatureCard/FeatureCard.spec.js +70 -0
  37. package/src/cards/FeatureCard/FeatureCard.tsx +123 -0
  38. package/src/cards/FeatureCard/index.ts +1 -0
  39. package/src/cards/index.ts +3 -0
  40. package/src/data/Bar/Bar.module.scss +105 -0
  41. package/src/data/Bar/Bar.tsx +161 -0
  42. package/src/data/Bar/index.ts +1 -0
  43. package/src/data/Line/Line.module.scss +102 -0
  44. package/src/data/Line/Line.tsx +162 -0
  45. package/src/data/Line/index.ts +1 -0
  46. package/src/data/Pie/Pie.module.scss +56 -0
  47. package/src/data/Pie/Pie.spec.js +72 -0
  48. package/src/data/Pie/Pie.tsx +111 -0
  49. package/src/data/Pie/index.ts +1 -0
  50. package/src/data/index.ts +3 -0
  51. package/src/editor/Editor.module.scss +125 -0
  52. package/src/editor/Editor.tsx +327 -0
  53. package/src/editor/common/elements.ts +50 -0
  54. package/src/editor/common/index.ts +2 -0
  55. package/src/editor/common/marks.ts +27 -0
  56. package/src/editor/components/MediaDrawer/MediaDrawer.module.scss +316 -0
  57. package/src/editor/components/MediaDrawer/MediaDrawer.tsx +457 -0
  58. package/src/editor/components/MediaDrawer/index.ts +1 -0
  59. package/src/editor/components/index.ts +1 -0
  60. package/src/editor/config/default.ts +213 -0
  61. package/src/editor/config/index.ts +2 -0
  62. package/src/editor/config/props.ts +9 -0
  63. package/src/editor/index.ts +2 -0
  64. package/src/editor/plateUI.ts +82 -0
  65. package/src/editor/plugins/blocks.tsx +71 -0
  66. package/src/editor/plugins/custom/assets/DefaultThumbnail.tsx +57 -0
  67. package/src/editor/plugins/custom/assets/index.ts +1 -0
  68. package/src/editor/plugins/custom/buttons.tsx +289 -0
  69. package/src/editor/plugins/custom/example.tsx +64 -0
  70. package/src/editor/plugins/custom/exitBreak.ts +41 -0
  71. package/src/editor/plugins/custom/footnote.tsx +185 -0
  72. package/src/editor/plugins/custom/index.ts +14 -0
  73. package/src/editor/plugins/custom/paywall.tsx +156 -0
  74. package/src/editor/plugins/custom/qa.tsx +390 -0
  75. package/src/editor/plugins/custom/resetBlockType.ts +29 -0
  76. package/src/editor/plugins/custom/selectOnBackspace.ts +7 -0
  77. package/src/editor/plugins/custom/softBreak.ts +20 -0
  78. package/src/editor/plugins/custom/styles/Button.module.scss +51 -0
  79. package/src/editor/plugins/custom/styles/Footnote.module.scss +58 -0
  80. package/src/editor/plugins/custom/styles/Paywall.module.scss +67 -0
  81. package/src/editor/plugins/custom/styles/QA.module.scss +140 -0
  82. package/src/editor/plugins/custom/styles/Video.module.scss +79 -0
  83. package/src/editor/plugins/custom/video.tsx +163 -0
  84. package/src/editor/plugins/index.ts +18 -0
  85. package/src/editor/plugins/inline.ts +46 -0
  86. package/src/editor/plugins/marks.ts +25 -0
  87. package/src/editor/plugins/utils.ts +22 -0
  88. package/src/feedback/Chip/Chip.module.scss +23 -0
  89. package/src/feedback/Chip/Chip.tsx +58 -0
  90. package/src/feedback/Chip/index.ts +1 -0
  91. package/src/feedback/Loader/Loader.module.scss +18 -0
  92. package/src/feedback/Loader/Loader.spec.js +18 -0
  93. package/src/feedback/Loader/Loader.tsx +53 -0
  94. package/src/feedback/Loader/index.ts +1 -0
  95. package/src/feedback/ProgressBar/ProgressBar.module.scss +13 -0
  96. package/src/feedback/ProgressBar/ProgressBar.tsx +32 -0
  97. package/src/feedback/ProgressBar/index.ts +1 -0
  98. package/src/feedback/Toast/Toast.module.scss +44 -0
  99. package/src/feedback/Toast/Toast.tsx +76 -0
  100. package/src/feedback/Toast/index.ts +1 -0
  101. package/src/feedback/Tooltip/Tooltip.module.scss +47 -0
  102. package/src/feedback/Tooltip/Tooltip.tsx +10 -0
  103. package/src/feedback/Tooltip/index.ts +1 -0
  104. package/src/feedback/index.ts +5 -0
  105. package/src/global.d.ts +6 -0
  106. package/src/iconography/Avatar/Avatar.module.scss +90 -0
  107. package/src/iconography/Avatar/Avatar.spec.js +75 -0
  108. package/src/iconography/Avatar/Avatar.tsx +96 -0
  109. package/src/iconography/Avatar/DefaultIcon.svg +4 -0
  110. package/src/iconography/Avatar/DefaultIcon.tsx +12 -0
  111. package/src/iconography/Avatar/iconHelpers.tsx +186 -0
  112. package/src/iconography/Avatar/index.ts +1 -0
  113. package/src/iconography/ColoredIcon/ColoredIcon.module.scss +40 -0
  114. package/src/iconography/ColoredIcon/ColoredIcon.tsx +30 -0
  115. package/src/iconography/ColoredIcon/index.ts +5 -0
  116. package/src/iconography/DevicePreview/DevicePreview.module.scss +143 -0
  117. package/src/iconography/DevicePreview/DevicePreview.tsx +592 -0
  118. package/src/iconography/DevicePreview/index.ts +1 -0
  119. package/src/iconography/IconHeader/IconHeader.module.scss +42 -0
  120. package/src/iconography/IconHeader/IconHeader.tsx +42 -0
  121. package/src/iconography/IconHeader/index.ts +1 -0
  122. package/src/iconography/StarRating/StarRating.tsx +99 -0
  123. package/src/iconography/StarRating/index.ts +1 -0
  124. package/src/iconography/index.ts +5 -0
  125. package/src/implementations/BodyContent/BodyContent.module.scss +38 -0
  126. package/src/implementations/BodyContent/BodyContent.tsx +78 -0
  127. package/src/implementations/BodyContent/index.ts +2 -0
  128. package/src/implementations/JoinGroupModal/JoinGroupModal.module.scss +83 -0
  129. package/src/implementations/JoinGroupModal/JoinGroupModal.tsx +176 -0
  130. package/src/implementations/JoinGroupModal/index.ts +1 -0
  131. package/src/implementations/index.ts +2 -0
  132. package/src/index.ts +149 -0
  133. package/src/inputs/CalendarInput/CalendarInput.module.scss +38 -0
  134. package/src/inputs/CalendarInput/CalendarInput.spec.js +19 -0
  135. package/src/inputs/CalendarInput/CalendarInput.tsx +29 -0
  136. package/src/inputs/CalendarInput/index.ts +1 -0
  137. package/src/inputs/CheckboxInput/CheckboxInput.module.scss +23 -0
  138. package/src/inputs/CheckboxInput/CheckboxInput.tsx +39 -0
  139. package/src/inputs/CheckboxInput/index.ts +1 -0
  140. package/src/inputs/FeedInput/FeedInput.module.scss +48 -0
  141. package/src/inputs/FeedInput/FeedInput.spec.js +16 -0
  142. package/src/inputs/FeedInput/FeedInput.tsx +197 -0
  143. package/src/inputs/FeedInput/index.ts +1 -0
  144. package/src/inputs/InboxInput/InboxInput.module.scss +48 -0
  145. package/src/inputs/InboxInput/InboxInput.spec.js +19 -0
  146. package/src/inputs/InboxInput/InboxInput.tsx +97 -0
  147. package/src/inputs/InboxInput/index.ts +1 -0
  148. package/src/inputs/PostInput/PostInput.module.scss +49 -0
  149. package/src/inputs/PostInput/PostInput.spec.js +19 -0
  150. package/src/inputs/PostInput/PostInput.tsx +54 -0
  151. package/src/inputs/PostInput/index.ts +1 -0
  152. package/src/inputs/RadioInput/RadioInput.module.scss +68 -0
  153. package/src/inputs/RadioInput/RadioInput.tsx +55 -0
  154. package/src/inputs/RadioInput/index.ts +1 -0
  155. package/src/inputs/SearchInput/SearchInput.module.scss +40 -0
  156. package/src/inputs/SearchInput/SearchInput.tsx +61 -0
  157. package/src/inputs/SearchInput/index.ts +1 -0
  158. package/src/inputs/SelectInput/SelectInput.module.scss +66 -0
  159. package/src/inputs/SelectInput/SelectInput.tsx +145 -0
  160. package/src/inputs/SelectInput/index.ts +1 -0
  161. package/src/inputs/TagInput/TagInput.module.scss +75 -0
  162. package/src/inputs/TagInput/TagInput.tsx +115 -0
  163. package/src/inputs/TagInput/index.ts +1 -0
  164. package/src/inputs/TextInput/TextInput.module.scss +35 -0
  165. package/src/inputs/TextInput/TextInput.tsx +46 -0
  166. package/src/inputs/TextInput/index.ts +1 -0
  167. package/src/inputs/index.ts +10 -0
  168. package/src/lists/ContactDetails/ContactDetails.module.scss +70 -0
  169. package/src/lists/ContactDetails/ContactDetails.spec.js +69 -0
  170. package/src/lists/ContactDetails/ContactDetails.tsx +185 -0
  171. package/src/lists/ContactDetails/index.ts +1 -0
  172. package/src/lists/index.ts +1 -0
  173. package/src/navigation/Breadcrumbs/Breadcrumbs.module.scss +18 -0
  174. package/src/navigation/Breadcrumbs/Breadcrumbs.spec.js +38 -0
  175. package/src/navigation/Breadcrumbs/Breadcrumbs.tsx +43 -0
  176. package/src/navigation/Breadcrumbs/index.ts +1 -0
  177. package/src/navigation/Drawer/Drawer.module.scss +104 -0
  178. package/src/navigation/Drawer/Drawer.tsx +177 -0
  179. package/src/navigation/Drawer/index.ts +1 -0
  180. package/src/navigation/EditorBar/EditorBar.module.scss +118 -0
  181. package/src/navigation/EditorBar/EditorBar.tsx +416 -0
  182. package/src/navigation/EditorBar/components/AlignmentDropdown/AlignmentDropdown.tsx +106 -0
  183. package/src/navigation/EditorBar/components/AlignmentDropdown/index.ts +1 -0
  184. package/src/navigation/EditorBar/components/ButtonModal/ButtonModal.module.scss +85 -0
  185. package/src/navigation/EditorBar/components/ButtonModal/ButtonModal.tsx +314 -0
  186. package/src/navigation/EditorBar/components/ButtonModal/assets/Comment.tsx +28 -0
  187. package/src/navigation/EditorBar/components/ButtonModal/assets/GiftSubscription.tsx +28 -0
  188. package/src/navigation/EditorBar/components/ButtonModal/assets/Link.tsx +28 -0
  189. package/src/navigation/EditorBar/components/ButtonModal/assets/Share.tsx +28 -0
  190. package/src/navigation/EditorBar/components/ButtonModal/assets/ShareCommunity.tsx +42 -0
  191. package/src/navigation/EditorBar/components/ButtonModal/assets/Signup.tsx +68 -0
  192. package/src/navigation/EditorBar/components/ButtonModal/assets/Special.tsx +24 -0
  193. package/src/navigation/EditorBar/components/ButtonModal/assets/Subscribe.tsx +28 -0
  194. package/src/navigation/EditorBar/components/ButtonModal/assets/index.ts +8 -0
  195. package/src/navigation/EditorBar/components/ButtonModal/index.ts +1 -0
  196. package/src/navigation/EditorBar/components/FontDropdown/FontDropdown.module.scss +16 -0
  197. package/src/navigation/EditorBar/components/FontDropdown/FontDropdown.tsx +137 -0
  198. package/src/navigation/EditorBar/components/FontDropdown/index.ts +1 -0
  199. package/src/navigation/EditorBar/components/MoreDropdown/MoreDropdown.module.scss +43 -0
  200. package/src/navigation/EditorBar/components/MoreDropdown/MoreDropdown.tsx +124 -0
  201. package/src/navigation/EditorBar/components/MoreDropdown/index.ts +1 -0
  202. package/src/navigation/EditorBar/components/OutlineDropdown/OutlineDropdown.module.scss +21 -0
  203. package/src/navigation/EditorBar/components/OutlineDropdown/OutlineDropdown.tsx +37 -0
  204. package/src/navigation/EditorBar/components/OutlineDropdown/index.ts +1 -0
  205. package/src/navigation/EditorBar/components/TextTypeDropdown/TextTypeDropdown.module.scss +51 -0
  206. package/src/navigation/EditorBar/components/TextTypeDropdown/TextTypeDropdown.tsx +80 -0
  207. package/src/navigation/EditorBar/components/TextTypeDropdown/index.ts +1 -0
  208. package/src/navigation/EditorBar/components/VideoModal/VideoModal.module.scss +150 -0
  209. package/src/navigation/EditorBar/components/VideoModal/VideoModal.tsx +163 -0
  210. package/src/navigation/EditorBar/components/VideoModal/index.ts +1 -0
  211. package/src/navigation/EditorBar/components/index.ts +7 -0
  212. package/src/navigation/EditorBar/index.ts +1 -0
  213. package/src/navigation/MenuTabs/MenuTabs.module.scss +34 -0
  214. package/src/navigation/MenuTabs/MenuTabs.spec.js +36 -0
  215. package/src/navigation/MenuTabs/MenuTabs.tsx +52 -0
  216. package/src/navigation/MenuTabs/index.ts +1 -0
  217. package/src/navigation/Navigation/Navigation.module.scss +92 -0
  218. package/src/navigation/Navigation/Navigation.spec.js +144 -0
  219. package/src/navigation/Navigation/Navigation.tsx +111 -0
  220. package/src/navigation/Navigation/SubNavigation.module.scss +255 -0
  221. package/src/navigation/Navigation/SubNavigation.spec.js +112 -0
  222. package/src/navigation/Navigation/SubNavigation.tsx +443 -0
  223. package/src/navigation/Navigation/index.ts +15 -0
  224. package/src/navigation/Pagination/Pagination.module.scss +49 -0
  225. package/src/navigation/Pagination/Pagination.tsx +115 -0
  226. package/src/navigation/Pagination/index.ts +1 -0
  227. package/src/navigation/index.ts +21 -0
  228. package/src/surfaces/Comment/Comment.module.scss +106 -0
  229. package/src/surfaces/Comment/Comment.spec.js +105 -0
  230. package/src/surfaces/Comment/Comment.tsx +157 -0
  231. package/src/surfaces/Comment/index.ts +1 -0
  232. package/src/surfaces/Faq/Faq.module.scss +91 -0
  233. package/src/surfaces/Faq/Faq.spec.js +38 -0
  234. package/src/surfaces/Faq/Faq.tsx +156 -0
  235. package/src/surfaces/Faq/index.ts +1 -0
  236. package/src/surfaces/Message/Message.module.scss +37 -0
  237. package/src/surfaces/Message/Message.spec.js +47 -0
  238. package/src/surfaces/Message/Message.tsx +54 -0
  239. package/src/surfaces/Message/index.ts +1 -0
  240. package/src/surfaces/Modal/Modal.module.scss +52 -0
  241. package/src/surfaces/Modal/Modal.spec.js +38 -0
  242. package/src/surfaces/Modal/Modal.tsx +131 -0
  243. package/src/surfaces/Modal/index.ts +5 -0
  244. package/src/surfaces/Plan/Plan.module.scss +79 -0
  245. package/src/surfaces/Plan/Plan.tsx +75 -0
  246. package/src/surfaces/Plan/index.ts +1 -0
  247. package/src/surfaces/Post/Post.module.scss +46 -0
  248. package/src/surfaces/Post/Post.spec.js +103 -0
  249. package/src/surfaces/Post/Post.tsx +185 -0
  250. package/src/surfaces/Post/index.ts +1 -0
  251. package/src/surfaces/Post/postHelpers.ts +20 -0
  252. package/src/surfaces/ProfileHeader/ProfileHeader.module.scss +202 -0
  253. package/src/surfaces/ProfileHeader/ProfileHeader.tsx +103 -0
  254. package/src/surfaces/ProfileHeader/index.ts +1 -0
  255. package/src/surfaces/RatingsOverview/RatingsOverview.module.scss +54 -0
  256. package/src/surfaces/RatingsOverview/RatingsOverview.tsx +69 -0
  257. package/src/surfaces/RatingsOverview/index.ts +1 -0
  258. package/src/surfaces/Review/Review.module.scss +73 -0
  259. package/src/surfaces/Review/Review.tsx +88 -0
  260. package/src/surfaces/Review/index.ts +1 -0
  261. package/src/surfaces/index.ts +9 -0
  262. package/src/tables/Filter/Filter.module.scss +34 -0
  263. package/src/tables/Filter/Filter.tsx +30 -0
  264. package/src/tables/Filter/index.ts +1 -0
  265. package/src/tables/Table/Table.module.scss +126 -0
  266. package/src/tables/Table/Table.spec.js +113 -0
  267. package/src/tables/Table/Table.tsx +251 -0
  268. package/src/tables/Table/index.ts +7 -0
  269. package/src/tables/index.ts +7 -0
  270. package/tsconfig.json +14 -0
  271. package/vite.config.ts +29 -0
@@ -0,0 +1,185 @@
1
+ import React from "react";
2
+ import postStyles from "./Post.module.scss";
3
+ import { abbrRelativeTimeString } from "@soul-refiner/utils/src";
4
+ import { User } from "@soul-refiner/models";
5
+ import {
6
+ EllipsisHorizontal,
7
+ Like,
8
+ LikeOutline,
9
+ CommentOutline,
10
+ ShareOutline,
11
+ } from "@soul-refiner/icons/src";
12
+ import { Comment, CommentProps } from "../Comment";
13
+ import { Avatar } from "../../iconography";
14
+ import { Button } from "../../actions";
15
+ import { PostInput } from "../../inputs";
16
+ import { countComments } from "./postHelpers";
17
+
18
+ export interface PostProps extends React.PropsWithChildren {
19
+ comments: CommentProps[];
20
+ content: string;
21
+ created: Date;
22
+ hasReacted: boolean;
23
+ locked: boolean;
24
+ onComment: (comment: string) => void;
25
+ onReact: () => void;
26
+ onShare: () => void;
27
+ poster: User;
28
+ postId: string;
29
+ reactions: number;
30
+ shares?: number;
31
+ userAvatarSrc: string;
32
+ }
33
+
34
+ export const Post = ({
35
+ comments,
36
+ children,
37
+ content,
38
+ created,
39
+ hasReacted,
40
+ onComment,
41
+ onReact,
42
+ onShare,
43
+ poster,
44
+ reactions,
45
+ shares,
46
+ userAvatarSrc,
47
+ }: PostProps) => {
48
+ const [comment, setComment] = React.useState("");
49
+ const [showComments, setShowComments] = React.useState(false);
50
+
51
+ const handleShowComments = () => setShowComments((prev) => !prev);
52
+
53
+ const handleChange = (event: React.KeyboardEvent<HTMLTextAreaElement>) => {
54
+ setComment((event.target as HTMLTextAreaElement).value);
55
+ };
56
+
57
+ const handleReplySubmit = (
58
+ event: React.KeyboardEvent<HTMLTextAreaElement>
59
+ ) => {
60
+ if (event.key === "Enter") {
61
+ event.preventDefault();
62
+ onComment(comment);
63
+ handleShowComments();
64
+ setComment("");
65
+ }
66
+ };
67
+
68
+ const commentCount = comments?.length ? countComments(comments) : 0;
69
+
70
+ return (
71
+ <section className={`${postStyles.post}`}>
72
+ <div className="post-header">
73
+ <Avatar
74
+ as="a"
75
+ data-testid="post-avatar"
76
+ href=""
77
+ size={64}
78
+ title={`${poster.firstName} ${poster.lastName}`}
79
+ subtitle={abbrRelativeTimeString(created)}
80
+ url={poster.avatar ? poster.avatar : ""}
81
+ />
82
+ <EllipsisHorizontal
83
+ as="button"
84
+ size={24}
85
+ iconSize={19}
86
+ fill="var(--color-grey-4)"
87
+ />
88
+ </div>
89
+ <p className="body post-content body-large">{content}</p>
90
+ <div className="children">{children}</div>
91
+ <div className="action-bar">
92
+ <Button
93
+ bold={false}
94
+ buttonColor="white"
95
+ color="var(--color-grey-4)"
96
+ icon={
97
+ hasReacted ? (
98
+ <Like iconSize={20} size={21} fill="var(--colorify-blue-3)" />
99
+ ) : (
100
+ <LikeOutline
101
+ iconSize={20}
102
+ size={21}
103
+ fill="var(--colorify-blue-3)"
104
+ />
105
+ )
106
+ }
107
+ onClick={onReact}
108
+ shape="rectangular"
109
+ style={
110
+ {
111
+ "--hover-color": "var(--color-grey-9)",
112
+ } as React.CSSProperties
113
+ }
114
+ uppercase={false}
115
+ >
116
+ {reactions ? reactions + " Likes" : "Like"}
117
+ </Button>
118
+ <Button
119
+ bold={false}
120
+ buttonColor="white"
121
+ color="var(--color-grey-4)"
122
+ icon={
123
+ <CommentOutline
124
+ iconSize={16}
125
+ size={21}
126
+ fill="var(--colorify-blue-3)"
127
+ />
128
+ }
129
+ onClick={handleShowComments}
130
+ shape="rectangular"
131
+ style={
132
+ {
133
+ "--hover-color": "var(--color-grey-9)",
134
+ } as React.CSSProperties
135
+ }
136
+ uppercase={false}
137
+ >
138
+ {commentCount === 0
139
+ ? "Comment"
140
+ : commentCount === 1
141
+ ? "1 Comment"
142
+ : commentCount + " Comments"}
143
+ </Button>
144
+ <Button
145
+ bold={false}
146
+ buttonColor="white"
147
+ color="var(--color-grey-4)"
148
+ icon={
149
+ <ShareOutline
150
+ iconSize={21}
151
+ size={21}
152
+ fill="var(--colorify-blue-3)"
153
+ />
154
+ }
155
+ onClick={onShare}
156
+ shape="rectangular"
157
+ style={
158
+ {
159
+ "--hover-color": "var(--color-grey-9)",
160
+ } as React.CSSProperties
161
+ }
162
+ uppercase={false}
163
+ >
164
+ {shares ? shares + " Shares" : "Share"}
165
+ </Button>
166
+ </div>
167
+ {showComments && !!comments.length && (
168
+ <div className="comments">
169
+ {comments.map((comment) => (
170
+ <Comment key={comment.id} {...comment} />
171
+ ))}
172
+ </div>
173
+ )}
174
+ <form className="input-bar">
175
+ <Avatar size={40} url={userAvatarSrc} />
176
+ <PostInput
177
+ placeholder="Write a comment"
178
+ onChange={handleChange}
179
+ onKeyDown={handleReplySubmit}
180
+ value={comment}
181
+ />
182
+ </form>
183
+ </section>
184
+ );
185
+ };
@@ -0,0 +1 @@
1
+ export { Post, type PostProps } from "./Post";
@@ -0,0 +1,20 @@
1
+ import { CommentProps } from "../Comment";
2
+
3
+ export const countComments = (comments: CommentProps[]) => {
4
+ return comments.reduce((prev: number, current: CommentProps) => {
5
+ let currentNumber = 1;
6
+ if (!!current.replies) {
7
+ currentNumber = currentNumber + current.replies.length;
8
+ }
9
+ return prev + currentNumber;
10
+ }, 0);
11
+
12
+ // TODO: recursively return total of all comments
13
+ // return comments.reduce((prev: number, current: CommentProps) => {
14
+ // let currentNumber = 1;
15
+ // if (!!current.replies) {
16
+ // currentNumber = currentNumber + countComments(current.replies);
17
+ // }
18
+ // return prev + currentNumber;
19
+ // }, 0);
20
+ };
@@ -0,0 +1,202 @@
1
+ .header {
2
+ display: flex;
3
+ flex-direction: column;
4
+ position: relative;
5
+ border-radius: var(--border-radius-normal);
6
+ overflow: hidden;
7
+ background-color: #FFF;
8
+ box-shadow: 0 -4px inset #F5F5F5;
9
+
10
+
11
+ .hero {
12
+ height: 640px;
13
+ background-color: black;
14
+ position: relative;
15
+
16
+ .heroImage {
17
+ height: 100%;
18
+ }
19
+
20
+ .editHeroButton {
21
+ position: absolute;
22
+ bottom: 0;
23
+ right: 0;
24
+ bottom: 20px;
25
+ right: 20px;
26
+ background-color: var(--color-grey-7);
27
+
28
+ [class~=icon] {
29
+ background-color: transparent;
30
+ }
31
+
32
+ & svg {
33
+ fill: var(--color-grey-2);
34
+ }
35
+
36
+ [class~=icon] {
37
+ background-color: transparent;
38
+ }
39
+
40
+ &:active {
41
+ color: var(--color-grey-3);
42
+ & svg {
43
+ fill: var(--color-grey-3);
44
+ }
45
+ }
46
+
47
+ span {
48
+ display: flex;
49
+ gap: 8px;
50
+ place-items: center;
51
+ place-content: center;
52
+ }
53
+ }
54
+ }
55
+
56
+ .details {
57
+ gap: 16px;
58
+ display: flex;
59
+ flex-direction: column;
60
+ position: relative;
61
+ padding: 0 128px;
62
+ }
63
+
64
+ [class~=headerPadding] {
65
+ padding-top: 47px;
66
+ }
67
+
68
+ [class~=avatar] {
69
+ position: absolute;
70
+ left: 50%;
71
+ top: 0;
72
+ background-color: white;
73
+ border: 4px solid white;
74
+ height: 175px;
75
+ width: 175px;
76
+ border-radius: 100%;
77
+ transform: translateY(-50%) translateX(-50%);
78
+ }
79
+
80
+ .editAvatarButton {
81
+ background-color: var(--color-grey-7);
82
+ width: 40px;
83
+ height: 40px;
84
+ border-radius: 100%;
85
+ position: absolute;
86
+ bottom: 0;
87
+ right: 0;
88
+ display: flex;
89
+ place-items: center;
90
+ place-content: center;
91
+ & svg {
92
+ fill: var(--color-grey-2);
93
+ }
94
+
95
+ [class~=icon] {
96
+ background-color: transparent;
97
+ }
98
+
99
+ &:active {
100
+ & svg {
101
+ fill: var(--color-grey-3);
102
+ }
103
+ }
104
+ }
105
+
106
+ .avatar- {
107
+
108
+ &profile {
109
+ max-width: 140px;
110
+ max-height: 140px;
111
+ top: 50%;
112
+ img {
113
+ max-height: 100%;
114
+ max-width: 100%;
115
+ border-radius: 100%;
116
+ }
117
+ }
118
+
119
+ &group, &channel {
120
+ max-width: 175px;
121
+ max-height: 175px;
122
+
123
+ img {
124
+ max-height: 100%;
125
+ max-width: 100%;
126
+ border-radius: 100%;
127
+ }
128
+
129
+ }
130
+ }
131
+
132
+ .editAvatarButton:hover, .editHeroButton:hover {
133
+ background-color: var(--color-grey-8);
134
+ }
135
+
136
+ .upper {
137
+ display: flex;
138
+ flex-direction: row;
139
+ place-content: space-between;
140
+ place-items: flex-end;
141
+
142
+ .title {
143
+ font-size: var(--size-24);
144
+ color: var(--color-grey-0);
145
+ }
146
+
147
+ .subtitle {
148
+ font-size: var(--size-16);
149
+ color: var(--color-grey-6);
150
+ }
151
+
152
+ .stats {
153
+ display: flex;
154
+ flex-direction: row;
155
+ gap: 16px;
156
+ place-items: center;
157
+ font-size: var(--size-14);
158
+ color: var(--color-grey-6);
159
+ }
160
+ }
161
+
162
+ .lower {
163
+ border-top: 1px solid #e8e8e8;
164
+ display: flex;
165
+ flex-direction: row;
166
+ place-content: space-between;
167
+ height: 65px;
168
+ place-items: stretch;
169
+ padding-bottom: 4px;
170
+
171
+ .actions {
172
+ display: flex;
173
+ gap: 16px;
174
+ place-items: center;
175
+ }
176
+ }
177
+
178
+ [class~=ctaButton] {
179
+ background-color: var(--color-blue-3);
180
+ color: #FFF;
181
+ font-size: var(--size-14);
182
+ font-weight: var(--weight-inter-semibold);
183
+
184
+ &:hover {
185
+ background-color: var(--color-blue-2);
186
+
187
+ [class~=icon] {
188
+ background-color: rgba(255 255 255 / 20%);
189
+ }
190
+ }
191
+
192
+ [class~=icon] {
193
+ background-color: rgba(255 255 255 / 20%);
194
+
195
+ &>svg {
196
+ fill: #FFF;
197
+ }
198
+ }
199
+ }
200
+
201
+
202
+ }
@@ -0,0 +1,103 @@
1
+ import React from "react";
2
+ import { Camera } from "@soul-refiner/icons/src";
3
+ import headerStyles from "./ProfileHeader.module.scss";
4
+ import { MenuTabs } from "../../navigation/MenuTabs";
5
+ import { Button } from "../../actions";
6
+
7
+ export interface ProfileHeaderProps {
8
+ avatarUrl: string;
9
+ heroUrl: string;
10
+ title: string;
11
+ subtitle: string;
12
+ isOwner: boolean;
13
+ menuItems: Array<React.ReactNode>;
14
+ activeMenuItem: number;
15
+ actionItems?: React.ReactNode;
16
+ statItems?: React.ReactNode;
17
+ onChangeAvatar: () => void;
18
+ onChangeHero: () => void;
19
+ onTabClick: (index: number) => void;
20
+ headerType: "group" | "channel" | "profile" | "course";
21
+ }
22
+
23
+ export const ProfileHeader = ({
24
+ avatarUrl,
25
+ heroUrl,
26
+ title = "John Doe",
27
+ subtitle = "Subtitle",
28
+ isOwner = false,
29
+ headerType = "group",
30
+ menuItems = [],
31
+ activeMenuItem = 0,
32
+ actionItems,
33
+ statItems,
34
+ onChangeAvatar,
35
+ onChangeHero,
36
+ onTabClick,
37
+ }: ProfileHeaderProps) => {
38
+ return (
39
+ <div className={`${headerStyles.header}`}>
40
+ {headerType !== "course" && headerType !== "profile" && (
41
+ <div className={headerStyles.hero}>
42
+ <img src={heroUrl} className={headerStyles.heroImage} />
43
+ {isOwner && (
44
+ <Button
45
+ className={headerStyles.editHeroButton}
46
+ onClick={onChangeHero}
47
+ color="var(--color-grey-0)"
48
+ uppercase={false}
49
+ >
50
+ <Camera
51
+ fill="var(--color-grey-1)"
52
+ iconSize={21}
53
+ size={21}
54
+ inline={true}
55
+ style={{ margin: 0 }}
56
+ />{" "}
57
+ Edit
58
+ </Button>
59
+ )}
60
+ </div>
61
+ )}
62
+ <div className={headerStyles.details}>
63
+ {headerType !== "course" && (
64
+ <>
65
+ <div className={`${headerStyles[`avatar-${headerType}`]} avatar`}>
66
+ <img src={avatarUrl} />
67
+ {isOwner && (
68
+ <Button
69
+ className={headerStyles.editAvatarButton}
70
+ onClick={onChangeAvatar}
71
+ padded={false}
72
+ >
73
+ <Camera
74
+ fill="var(--color-grey-1)"
75
+ iconSize={21}
76
+ size={21}
77
+ style={{ margin: 0 }}
78
+ />
79
+ </Button>
80
+ )}
81
+ </div>
82
+
83
+ <div className={`${headerStyles.upper} headerPadding`}>
84
+ <div className={headerStyles.titles}>
85
+ <div className={headerStyles.title}>{title}</div>
86
+ <div className={headerStyles.subtitle}>{subtitle}</div>
87
+ </div>
88
+ <div className={headerStyles.stats}>{statItems}</div>
89
+ </div>
90
+ </>
91
+ )}
92
+ <div className={headerStyles.lower}>
93
+ <MenuTabs
94
+ activeItem={activeMenuItem}
95
+ onTabClick={onTabClick}
96
+ tabItems={menuItems}
97
+ />
98
+ <div className={headerStyles.actions}>{actionItems}</div>
99
+ </div>
100
+ </div>
101
+ </div>
102
+ );
103
+ };
@@ -0,0 +1 @@
1
+ export { ProfileHeader, type ProfileHeaderProps } from "./ProfileHeader";
@@ -0,0 +1,54 @@
1
+ .ratingsOverview {
2
+
3
+ display: flex;
4
+ flex-direction: column;
5
+ gap: 16px;
6
+
7
+ [class~=upper] {
8
+ display: flex;
9
+ flex-direction: column;
10
+ place-items: center;
11
+ gap: 10px;
12
+
13
+ &>div {
14
+ color: var(--color-grey-3);
15
+ font-weight: var(--weight-inter-bold);
16
+
17
+ &:first-child {
18
+ font-size: 3.8em;
19
+ }
20
+
21
+ &:last-child {
22
+ font-size: var(--size-16);
23
+ }
24
+ }
25
+ }
26
+
27
+ .ratingElement {
28
+ display: flex;
29
+ flex-direction: row;
30
+ gap: 16px;
31
+ flex: 1;
32
+ place-items: center;
33
+
34
+ .stat, .statPercent {
35
+ font-size: var(--size-18);
36
+ font-weight: var(--weight-inter-bold);
37
+ color: var(--color-grey-5);
38
+ }
39
+
40
+ [class~=rating] {
41
+ display: flex;
42
+ place-items: center;
43
+ width: 40px;
44
+ justify-content: space-between;
45
+ }
46
+
47
+ .statPercent {
48
+ font-size: var(--size-16);
49
+ place-content: flex-end;
50
+ width: 40px;
51
+ display: flex;
52
+ }
53
+ }
54
+ }
@@ -0,0 +1,69 @@
1
+ import React from "react";
2
+ import { Star } from "@soul-refiner/icons/src";
3
+ import ratingsStyle from "./RatingsOverview.module.scss";
4
+ import { StarRating } from "../../iconography";
5
+ import { ProgressBar } from "../../feedback";
6
+ import { Button } from "../../actions";
7
+
8
+ export interface RatingsOverviewProps {
9
+ rating: number;
10
+ reviewCount: number;
11
+ stars: RatingInterface;
12
+ onWriteReview: () => void;
13
+ }
14
+
15
+ export interface RatingInterface {
16
+ one: number;
17
+ two: number;
18
+ three: number;
19
+ four: number;
20
+ five: number;
21
+ }
22
+
23
+ export const RatingElement = (rating: number, percent: number) => {
24
+ return (
25
+ <div className={ratingsStyle.ratingElement}>
26
+ <div className="rating">
27
+ <div className={ratingsStyle.stat}>{rating}</div>
28
+ <div>
29
+ <Star fill="#D5A806" />
30
+ </div>
31
+ </div>
32
+
33
+ <ProgressBar color="var(--color-yellow-4)" percent={percent} />
34
+
35
+ <div className={ratingsStyle.statPercent}>{percent}%</div>
36
+ </div>
37
+ );
38
+ };
39
+
40
+ export const RatingsOverview = ({
41
+ rating = 4,
42
+ reviewCount = 4,
43
+ stars = { one: 1, two: 0, three: 0, four: 0, five: 50 },
44
+ onWriteReview = () => {
45
+ alert("On Write Review");
46
+ },
47
+ }: RatingsOverviewProps) => {
48
+ return (
49
+ <div className={ratingsStyle.ratingsOverview}>
50
+ <div className="upper">
51
+ <div>{rating}</div>
52
+ <div>
53
+ <StarRating rating={rating} width={147} />
54
+ </div>
55
+ <div>{reviewCount} reviews</div>
56
+ </div>
57
+ <div>
58
+ <div>{RatingElement(5, stars.five)}</div>
59
+ <div>{RatingElement(4, stars.four)}</div>
60
+ <div>{RatingElement(3, stars.three)}</div>
61
+ <div>{RatingElement(2, stars.two)}</div>
62
+ <div>{RatingElement(1, stars.one)}</div>
63
+ </div>
64
+ <Button buttonType="secondary" onClick={onWriteReview} fluid={true}>
65
+ Write a review
66
+ </Button>
67
+ </div>
68
+ );
69
+ };
@@ -0,0 +1 @@
1
+ export { RatingsOverview, type RatingsOverviewProps } from "./RatingsOverview";