From e00bf374d44ae197464bc7ba2a838690ee77865f Mon Sep 17 00:00:00 2001 From: Jonas de Luna Skulberg Date: Sat, 7 Sep 2024 16:49:27 +0200 Subject: [PATCH] Add comment sorting --- app/components/Comments/CommentView.css | 16 ++++ app/components/Comments/CommentView.tsx | 114 ++++++++++++++++++++++-- 2 files changed, 122 insertions(+), 8 deletions(-) create mode 100644 app/components/Comments/CommentView.css diff --git a/app/components/Comments/CommentView.css b/app/components/Comments/CommentView.css new file mode 100644 index 0000000000..535f029b28 --- /dev/null +++ b/app/components/Comments/CommentView.css @@ -0,0 +1,16 @@ +.headerContainer { + margin-bottom: 0.25rem; +} + +.sortIcon { + flex-direction: column; +} + +.iconWrapper { + margin-left: 0.25rem; +} + +.sortList { + margin-left: 0.5rem; + min-width: 10rem; +} diff --git a/app/components/Comments/CommentView.tsx b/app/components/Comments/CommentView.tsx index 3873401e0d..be40613005 100644 --- a/app/components/Comments/CommentView.tsx +++ b/app/components/Comments/CommentView.tsx @@ -1,11 +1,20 @@ -import { Flex, LoadingIndicator } from '@webkom/lego-bricks'; +import { + FilterSection, + Flex, + Icon, + LoadingIndicator, +} from '@webkom/lego-bricks'; +import { ListFilter } from 'lucide-react'; +import moment from 'moment'; +import { useEffect, useState, type CSSProperties } from 'react'; import CommentForm from 'app/components/CommentForm'; import { generateTreeStructure } from 'app/utils'; +import { SelectInput } from '../Form'; import CommentTree from './CommentTree'; +import styles from './CommentView.css'; import type Comment from 'app/store/models/Comment'; import type { ContentAuthors } from 'app/store/models/Comment'; import type { ContentTarget } from 'app/store/utils/contentTarget'; -import type { CSSProperties } from 'react'; type Props = { comments: Comment[]; @@ -17,6 +26,37 @@ type Props = { contentAuthors?: ContentAuthors; }; +const orderingOptions: Array