From d4f84a70284ff402dd222aa1f2e4ed27a568708c Mon Sep 17 00:00:00 2001 From: WindowsCrashed Date: Tue, 27 Jun 2023 19:12:40 -0300 Subject: [PATCH] add collapse to question list --- app/javascript/pages/question/List/QuestionsList.tsx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/app/javascript/pages/question/List/QuestionsList.tsx b/app/javascript/pages/question/List/QuestionsList.tsx index 5f144cd..adadad9 100644 --- a/app/javascript/pages/question/List/QuestionsList.tsx +++ b/app/javascript/pages/question/List/QuestionsList.tsx @@ -1,5 +1,5 @@ import React, { FC, useState } from 'react' -import { FaArrowLeft, FaArrowRight } from 'react-icons/fa'; +import { FaArrowLeft, FaArrowRight, FaAngleDown, FaAngleRight } from 'react-icons/fa'; import { MdModeEdit } from 'react-icons/md'; import { Link } from 'react-router-dom'; import styled from 'styled-components'; @@ -39,6 +39,7 @@ export const QuestionsListFragments = gql` export const QuestionsList: FC = ({ questions, title, pagination }) => { const { user } = useCurrentUser() const [pageCount, setPageCount] = useState(1) + const [collapsed, setCollapsed] = useState(false) const formatDate = (stringDate: string) => new Date(stringDate).toLocaleDateString() @@ -59,6 +60,11 @@ export const QuestionsList: FC = ({ questions, title, pagination }) => {

{title}

+
+ +
{questions.length > 0 &&

-
+ {!collapsed &&
{questions.length ?
{questions.map((question) => ( @@ -127,7 +133,7 @@ export const QuestionsList: FC = ({ questions, title, pagination }) => {
} -
+
}
) } \ No newline at end of file