@soul-refiner/design-system 0.0.10 → 0.0.11
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.
- package/dist/custom.d.ts +4 -0
- package/dist/index.d.ts +1 -0
- package/dist/{design-system.umd.cjs → index.umd.cjs} +1 -1
- package/dist/src/actions/Button/Button.module.scss +205 -0
- package/dist/src/actions/Button/Button.spec.js +56 -0
- package/dist/src/actions/Button/Button.tsx +143 -0
- package/dist/src/actions/Button/index.ts +1 -0
- package/dist/src/actions/Dropdown/Dropdown.module.scss +77 -0
- package/dist/src/actions/Dropdown/Dropdown.spec.js +149 -0
- package/dist/src/actions/Dropdown/Dropdown.tsx +224 -0
- package/dist/src/actions/Dropdown/index.ts +6 -0
- package/dist/src/actions/Dropzone/Dropzone.module.scss +48 -0
- package/dist/src/actions/Dropzone/Dropzone.spec.js +60 -0
- package/dist/src/actions/Dropzone/Dropzone.tsx +191 -0
- package/dist/src/actions/Dropzone/index.ts +1 -0
- package/dist/src/actions/Rate/Rate.module.scss +17 -0
- package/dist/src/actions/Rate/Rate.tsx +53 -0
- package/dist/src/actions/Rate/index.ts +1 -0
- package/dist/src/actions/Switch/Switch.module.scss +35 -0
- package/dist/src/actions/Switch/Switch.spec.js +31 -0
- package/dist/src/actions/Switch/Switch.tsx +34 -0
- package/dist/src/actions/Switch/index.ts +1 -0
- package/dist/src/actions/index.ts +5 -0
- package/dist/src/cards/CourseCard/CourseCard.module.scss +219 -0
- package/dist/src/cards/CourseCard/CourseCard.spec.js +60 -0
- package/dist/src/cards/CourseCard/CourseCard.tsx +145 -0
- package/dist/src/cards/CourseCard/index.ts +1 -0
- package/dist/src/cards/EpisodeCard/EpisodeCard.module.scss +69 -0
- package/dist/src/cards/EpisodeCard/EpisodeCard.tsx +53 -0
- package/dist/src/cards/EpisodeCard/index.ts +1 -0
- package/dist/src/cards/FeatureCard/FeatureCard.module.scss +116 -0
- package/dist/src/cards/FeatureCard/FeatureCard.spec.js +70 -0
- package/dist/src/cards/FeatureCard/FeatureCard.tsx +123 -0
- package/dist/src/cards/FeatureCard/index.ts +1 -0
- package/dist/src/cards/index.ts +3 -0
- package/dist/src/data/Bar/Bar.module.scss +105 -0
- package/dist/src/data/Bar/Bar.tsx +161 -0
- package/dist/src/data/Bar/index.ts +1 -0
- package/dist/src/data/Line/Line.module.scss +102 -0
- package/dist/src/data/Line/Line.tsx +162 -0
- package/dist/src/data/Line/index.ts +1 -0
- package/dist/src/data/Pie/Pie.module.scss +56 -0
- package/dist/src/data/Pie/Pie.spec.js +72 -0
- package/dist/src/data/Pie/Pie.tsx +111 -0
- package/dist/src/data/Pie/index.ts +1 -0
- package/dist/src/data/index.ts +3 -0
- package/dist/src/editor/Editor.module.scss +125 -0
- package/dist/src/editor/Editor.tsx +327 -0
- package/dist/src/editor/common/elements.ts +50 -0
- package/dist/src/editor/common/index.ts +2 -0
- package/dist/src/editor/common/marks.ts +27 -0
- package/dist/src/editor/components/MediaDrawer/MediaDrawer.module.scss +316 -0
- package/dist/src/editor/components/MediaDrawer/MediaDrawer.tsx +457 -0
- package/dist/src/editor/components/MediaDrawer/index.ts +1 -0
- package/dist/src/editor/components/index.ts +1 -0
- package/dist/src/editor/config/default.ts +213 -0
- package/dist/src/editor/config/index.ts +2 -0
- package/dist/src/editor/config/props.ts +9 -0
- package/dist/src/editor/index.ts +2 -0
- package/dist/src/editor/plateUI.ts +82 -0
- package/dist/src/editor/plugins/blocks.tsx +71 -0
- package/dist/src/editor/plugins/custom/assets/DefaultThumbnail.tsx +57 -0
- package/dist/src/editor/plugins/custom/assets/index.ts +1 -0
- package/dist/src/editor/plugins/custom/buttons.tsx +289 -0
- package/dist/src/editor/plugins/custom/example.tsx +64 -0
- package/dist/src/editor/plugins/custom/exitBreak.ts +41 -0
- package/dist/src/editor/plugins/custom/footnote.tsx +185 -0
- package/dist/src/editor/plugins/custom/index.ts +14 -0
- package/dist/src/editor/plugins/custom/paywall.tsx +156 -0
- package/dist/src/editor/plugins/custom/qa.tsx +390 -0
- package/dist/src/editor/plugins/custom/resetBlockType.ts +29 -0
- package/dist/src/editor/plugins/custom/selectOnBackspace.ts +7 -0
- package/dist/src/editor/plugins/custom/softBreak.ts +20 -0
- package/dist/src/editor/plugins/custom/styles/Button.module.scss +51 -0
- package/dist/src/editor/plugins/custom/styles/Footnote.module.scss +58 -0
- package/dist/src/editor/plugins/custom/styles/Paywall.module.scss +67 -0
- package/dist/src/editor/plugins/custom/styles/QA.module.scss +140 -0
- package/dist/src/editor/plugins/custom/styles/Video.module.scss +79 -0
- package/dist/src/editor/plugins/custom/video.tsx +163 -0
- package/dist/src/editor/plugins/index.ts +18 -0
- package/dist/src/editor/plugins/inline.ts +46 -0
- package/dist/src/editor/plugins/marks.ts +25 -0
- package/dist/src/editor/plugins/utils.ts +22 -0
- package/dist/src/feedback/Chip/Chip.module.scss +23 -0
- package/dist/src/feedback/Chip/Chip.tsx +58 -0
- package/dist/src/feedback/Chip/index.ts +1 -0
- package/dist/src/feedback/Loader/Loader.module.scss +18 -0
- package/dist/src/feedback/Loader/Loader.spec.js +18 -0
- package/dist/src/feedback/Loader/Loader.tsx +53 -0
- package/dist/src/feedback/Loader/index.ts +1 -0
- package/dist/src/feedback/ProgressBar/ProgressBar.module.scss +13 -0
- package/dist/src/feedback/ProgressBar/ProgressBar.tsx +32 -0
- package/dist/src/feedback/ProgressBar/index.ts +1 -0
- package/dist/src/feedback/Toast/Toast.module.scss +44 -0
- package/dist/src/feedback/Toast/Toast.tsx +76 -0
- package/dist/src/feedback/Toast/index.ts +1 -0
- package/dist/src/feedback/Tooltip/Tooltip.module.scss +47 -0
- package/dist/src/feedback/Tooltip/Tooltip.tsx +10 -0
- package/dist/src/feedback/Tooltip/index.ts +1 -0
- package/dist/src/feedback/index.ts +5 -0
- package/dist/src/global.d.ts +6 -0
- package/dist/src/iconography/Avatar/Avatar.module.scss +90 -0
- package/dist/src/iconography/Avatar/Avatar.spec.js +75 -0
- package/dist/src/iconography/Avatar/Avatar.tsx +96 -0
- package/dist/src/iconography/Avatar/DefaultIcon.svg +4 -0
- package/dist/src/iconography/Avatar/DefaultIcon.tsx +12 -0
- package/dist/src/iconography/Avatar/iconHelpers.tsx +186 -0
- package/dist/src/iconography/Avatar/index.ts +1 -0
- package/dist/src/iconography/ColoredIcon/ColoredIcon.module.scss +40 -0
- package/dist/src/iconography/ColoredIcon/ColoredIcon.tsx +30 -0
- package/dist/src/iconography/ColoredIcon/index.ts +5 -0
- package/dist/src/iconography/DevicePreview/DevicePreview.module.scss +143 -0
- package/dist/src/iconography/DevicePreview/DevicePreview.tsx +592 -0
- package/dist/src/iconography/DevicePreview/index.ts +1 -0
- package/dist/src/iconography/IconHeader/IconHeader.module.scss +42 -0
- package/dist/src/iconography/IconHeader/IconHeader.tsx +42 -0
- package/dist/src/iconography/IconHeader/index.ts +1 -0
- package/dist/src/iconography/StarRating/StarRating.tsx +99 -0
- package/dist/src/iconography/StarRating/index.ts +1 -0
- package/dist/src/iconography/index.ts +5 -0
- package/dist/src/implementations/BodyContent/BodyContent.module.scss +38 -0
- package/dist/src/implementations/BodyContent/BodyContent.tsx +78 -0
- package/dist/src/implementations/BodyContent/index.ts +2 -0
- package/dist/src/implementations/JoinGroupModal/JoinGroupModal.module.scss +83 -0
- package/dist/src/implementations/JoinGroupModal/JoinGroupModal.tsx +176 -0
- package/dist/src/implementations/JoinGroupModal/index.ts +1 -0
- package/dist/src/implementations/index.ts +2 -0
- package/dist/src/index.ts +149 -0
- package/dist/src/inputs/CalendarInput/CalendarInput.module.scss +38 -0
- package/dist/src/inputs/CalendarInput/CalendarInput.spec.js +19 -0
- package/dist/src/inputs/CalendarInput/CalendarInput.tsx +29 -0
- package/dist/src/inputs/CalendarInput/index.ts +1 -0
- package/dist/src/inputs/CheckboxInput/CheckboxInput.module.scss +23 -0
- package/dist/src/inputs/CheckboxInput/CheckboxInput.tsx +39 -0
- package/dist/src/inputs/CheckboxInput/index.ts +1 -0
- package/dist/src/inputs/FeedInput/FeedInput.module.scss +48 -0
- package/dist/src/inputs/FeedInput/FeedInput.spec.js +16 -0
- package/dist/src/inputs/FeedInput/FeedInput.tsx +197 -0
- package/dist/src/inputs/FeedInput/index.ts +1 -0
- package/dist/src/inputs/InboxInput/InboxInput.module.scss +48 -0
- package/dist/src/inputs/InboxInput/InboxInput.spec.js +19 -0
- package/dist/src/inputs/InboxInput/InboxInput.tsx +97 -0
- package/dist/src/inputs/InboxInput/index.ts +1 -0
- package/dist/src/inputs/PostInput/PostInput.module.scss +49 -0
- package/dist/src/inputs/PostInput/PostInput.spec.js +19 -0
- package/dist/src/inputs/PostInput/PostInput.tsx +54 -0
- package/dist/src/inputs/PostInput/index.ts +1 -0
- package/dist/src/inputs/RadioInput/RadioInput.module.scss +68 -0
- package/dist/src/inputs/RadioInput/RadioInput.tsx +55 -0
- package/dist/src/inputs/RadioInput/index.ts +1 -0
- package/dist/src/inputs/SearchInput/SearchInput.module.scss +40 -0
- package/dist/src/inputs/SearchInput/SearchInput.tsx +61 -0
- package/dist/src/inputs/SearchInput/index.ts +1 -0
- package/dist/src/inputs/SelectInput/SelectInput.module.scss +66 -0
- package/dist/src/inputs/SelectInput/SelectInput.tsx +145 -0
- package/dist/src/inputs/SelectInput/index.ts +1 -0
- package/dist/src/inputs/TagInput/TagInput.module.scss +75 -0
- package/dist/src/inputs/TagInput/TagInput.tsx +115 -0
- package/dist/src/inputs/TagInput/index.ts +1 -0
- package/dist/src/inputs/TextInput/TextInput.module.scss +35 -0
- package/dist/src/inputs/TextInput/TextInput.tsx +46 -0
- package/dist/src/inputs/TextInput/index.ts +1 -0
- package/dist/src/inputs/index.ts +10 -0
- package/dist/src/lists/ContactDetails/ContactDetails.module.scss +70 -0
- package/dist/src/lists/ContactDetails/ContactDetails.spec.js +69 -0
- package/dist/src/lists/ContactDetails/ContactDetails.tsx +185 -0
- package/dist/src/lists/ContactDetails/index.ts +1 -0
- package/dist/src/lists/index.ts +1 -0
- package/dist/src/navigation/Breadcrumbs/Breadcrumbs.module.scss +18 -0
- package/dist/src/navigation/Breadcrumbs/Breadcrumbs.spec.js +38 -0
- package/dist/src/navigation/Breadcrumbs/Breadcrumbs.tsx +43 -0
- package/dist/src/navigation/Breadcrumbs/index.ts +1 -0
- package/dist/src/navigation/Drawer/Drawer.module.scss +104 -0
- package/dist/src/navigation/Drawer/Drawer.tsx +177 -0
- package/dist/src/navigation/Drawer/index.ts +1 -0
- package/dist/src/navigation/EditorBar/EditorBar.module.scss +118 -0
- package/dist/src/navigation/EditorBar/EditorBar.tsx +416 -0
- package/dist/src/navigation/EditorBar/components/AlignmentDropdown/AlignmentDropdown.tsx +106 -0
- package/dist/src/navigation/EditorBar/components/AlignmentDropdown/index.ts +1 -0
- package/dist/src/navigation/EditorBar/components/ButtonModal/ButtonModal.module.scss +85 -0
- package/dist/src/navigation/EditorBar/components/ButtonModal/ButtonModal.tsx +314 -0
- package/dist/src/navigation/EditorBar/components/ButtonModal/assets/Comment.tsx +28 -0
- package/dist/src/navigation/EditorBar/components/ButtonModal/assets/GiftSubscription.tsx +28 -0
- package/dist/src/navigation/EditorBar/components/ButtonModal/assets/Link.tsx +28 -0
- package/dist/src/navigation/EditorBar/components/ButtonModal/assets/Share.tsx +28 -0
- package/dist/src/navigation/EditorBar/components/ButtonModal/assets/ShareCommunity.tsx +42 -0
- package/dist/src/navigation/EditorBar/components/ButtonModal/assets/Signup.tsx +68 -0
- package/dist/src/navigation/EditorBar/components/ButtonModal/assets/Special.tsx +24 -0
- package/dist/src/navigation/EditorBar/components/ButtonModal/assets/Subscribe.tsx +28 -0
- package/dist/src/navigation/EditorBar/components/ButtonModal/assets/index.ts +8 -0
- package/dist/src/navigation/EditorBar/components/ButtonModal/index.ts +1 -0
- package/dist/src/navigation/EditorBar/components/FontDropdown/FontDropdown.module.scss +16 -0
- package/dist/src/navigation/EditorBar/components/FontDropdown/FontDropdown.tsx +137 -0
- package/dist/src/navigation/EditorBar/components/FontDropdown/index.ts +1 -0
- package/dist/src/navigation/EditorBar/components/MoreDropdown/MoreDropdown.module.scss +43 -0
- package/dist/src/navigation/EditorBar/components/MoreDropdown/MoreDropdown.tsx +124 -0
- package/dist/src/navigation/EditorBar/components/MoreDropdown/index.ts +1 -0
- package/dist/src/navigation/EditorBar/components/OutlineDropdown/OutlineDropdown.module.scss +21 -0
- package/dist/src/navigation/EditorBar/components/OutlineDropdown/OutlineDropdown.tsx +37 -0
- package/dist/src/navigation/EditorBar/components/OutlineDropdown/index.ts +1 -0
- package/dist/src/navigation/EditorBar/components/TextTypeDropdown/TextTypeDropdown.module.scss +51 -0
- package/dist/src/navigation/EditorBar/components/TextTypeDropdown/TextTypeDropdown.tsx +80 -0
- package/dist/src/navigation/EditorBar/components/TextTypeDropdown/index.ts +1 -0
- package/dist/src/navigation/EditorBar/components/VideoModal/VideoModal.module.scss +150 -0
- package/dist/src/navigation/EditorBar/components/VideoModal/VideoModal.tsx +163 -0
- package/dist/src/navigation/EditorBar/components/VideoModal/index.ts +1 -0
- package/dist/src/navigation/EditorBar/components/index.ts +7 -0
- package/dist/src/navigation/EditorBar/index.ts +1 -0
- package/dist/src/navigation/MenuTabs/MenuTabs.module.scss +34 -0
- package/dist/src/navigation/MenuTabs/MenuTabs.spec.js +36 -0
- package/dist/src/navigation/MenuTabs/MenuTabs.tsx +52 -0
- package/dist/src/navigation/MenuTabs/index.ts +1 -0
- package/dist/src/navigation/Navigation/Navigation.module.scss +92 -0
- package/dist/src/navigation/Navigation/Navigation.spec.js +144 -0
- package/dist/src/navigation/Navigation/Navigation.tsx +111 -0
- package/dist/src/navigation/Navigation/SubNavigation.module.scss +255 -0
- package/dist/src/navigation/Navigation/SubNavigation.spec.js +112 -0
- package/dist/src/navigation/Navigation/SubNavigation.tsx +443 -0
- package/dist/src/navigation/Navigation/index.ts +15 -0
- package/dist/src/navigation/Pagination/Pagination.module.scss +49 -0
- package/dist/src/navigation/Pagination/Pagination.tsx +115 -0
- package/dist/src/navigation/Pagination/index.ts +1 -0
- package/dist/src/navigation/index.ts +21 -0
- package/dist/src/surfaces/Comment/Comment.module.scss +106 -0
- package/dist/src/surfaces/Comment/Comment.spec.js +105 -0
- package/dist/src/surfaces/Comment/Comment.tsx +157 -0
- package/dist/src/surfaces/Comment/index.ts +1 -0
- package/dist/src/surfaces/Faq/Faq.module.scss +91 -0
- package/dist/src/surfaces/Faq/Faq.spec.js +38 -0
- package/dist/src/surfaces/Faq/Faq.tsx +156 -0
- package/dist/src/surfaces/Faq/index.ts +1 -0
- package/dist/src/surfaces/Message/Message.module.scss +37 -0
- package/dist/src/surfaces/Message/Message.spec.js +47 -0
- package/dist/src/surfaces/Message/Message.tsx +54 -0
- package/dist/src/surfaces/Message/index.ts +1 -0
- package/dist/src/surfaces/Modal/Modal.module.scss +52 -0
- package/dist/src/surfaces/Modal/Modal.spec.js +38 -0
- package/dist/src/surfaces/Modal/Modal.tsx +131 -0
- package/dist/src/surfaces/Modal/index.ts +5 -0
- package/dist/src/surfaces/Plan/Plan.module.scss +79 -0
- package/dist/src/surfaces/Plan/Plan.tsx +75 -0
- package/dist/src/surfaces/Plan/index.ts +1 -0
- package/dist/src/surfaces/Post/Post.module.scss +46 -0
- package/dist/src/surfaces/Post/Post.spec.js +103 -0
- package/dist/src/surfaces/Post/Post.tsx +185 -0
- package/dist/src/surfaces/Post/index.ts +1 -0
- package/dist/src/surfaces/Post/postHelpers.ts +20 -0
- package/dist/src/surfaces/ProfileHeader/ProfileHeader.module.scss +202 -0
- package/dist/src/surfaces/ProfileHeader/ProfileHeader.tsx +103 -0
- package/dist/src/surfaces/ProfileHeader/index.ts +1 -0
- package/dist/src/surfaces/RatingsOverview/RatingsOverview.module.scss +54 -0
- package/dist/src/surfaces/RatingsOverview/RatingsOverview.tsx +69 -0
- package/dist/src/surfaces/RatingsOverview/index.ts +1 -0
- package/dist/src/surfaces/Review/Review.module.scss +73 -0
- package/dist/src/surfaces/Review/Review.tsx +88 -0
- package/dist/src/surfaces/Review/index.ts +1 -0
- package/dist/src/surfaces/index.ts +9 -0
- package/dist/src/tables/Filter/Filter.module.scss +34 -0
- package/dist/src/tables/Filter/Filter.tsx +30 -0
- package/dist/src/tables/Filter/index.ts +1 -0
- package/dist/src/tables/Table/Table.module.scss +126 -0
- package/dist/src/tables/Table/Table.spec.js +113 -0
- package/dist/src/tables/Table/Table.tsx +251 -0
- package/dist/src/tables/Table/index.ts +7 -0
- package/dist/src/tables/index.ts +7 -0
- package/package.json +3 -2
- /package/dist/{design-system.js → index.js} +0 -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";
|