From a3e2fc377672e2d0f6e8a7206d9ab0b539327fbf Mon Sep 17 00:00:00 2001 From: Giang Pham Date: Wed, 9 Apr 2025 14:22:11 -0500 Subject: [PATCH] collapse for RMP data --- client/src/components/SectionContent.tsx | 220 ++++++++++++----------- 1 file changed, 115 insertions(+), 105 deletions(-) diff --git a/client/src/components/SectionContent.tsx b/client/src/components/SectionContent.tsx index 335ab8c..38e1f5a 100644 --- a/client/src/components/SectionContent.tsx +++ b/client/src/components/SectionContent.tsx @@ -1,6 +1,6 @@ import { LinkOutlined } from "@ant-design/icons"; import type { Grades, RMPInstructor } from "@utd-grades/db"; -import { Col, Row } from "antd"; +import { Col, Collapse, Row } from "antd"; import { BarElement, CategoryScale, @@ -17,6 +17,8 @@ import { extractGrades, getColors } from "../utils"; ChartJS.register(CategoryScale, LinearScale, BarElement, ChartTooltip); +const { Panel } = Collapse; + const Container = styled.div` padding-top: 20px; padding-bottom: 50px; @@ -56,7 +58,6 @@ const GraphContainer = styled.div` const ProfessorDetailsContainer = styled.div` width: 100%; - margin-top: 2rem; @media (max-width: 992px) { & { @@ -68,7 +69,7 @@ const ProfessorDetailsContainer = styled.div` & { box-shadow: 0 15px 15px rgba(233, 233, 233, 0.7); border-radius: 5px; - padding: 20px; + padding: 5px 20px; } } `; @@ -381,111 +382,120 @@ export default function SectiSonContent({ - - - - - setHovered("rmpLink")} - onMouseLeave={() => setHovered(null)} - ref={rmpLinkRef} - > - Professor Details - {instructor?.url && } - {hovered && ( - <> -
+ More Detail} + key="1" + > + + + + setHovered("rmpLink")} + onMouseLeave={() => setHovered(null)} + ref={rmpLinkRef} > - See more on - RMP -
-
+ Professor Details + {instructor?.url && } + {hovered && ( + <> +
+ See more on + RMP +
+
+ + )} + + + + + + {instructor?.quality_rating ? ( + + {instructor.quality_rating} + + ) : ( + "N/A" + )} + + RMP Score + + + + {instructor?.difficulty_rating ? ( + + {instructor.difficulty_rating} + + ) : ( + "N/A" + )} + + Level of difficulty + + + + {instructor?.would_take_again ? `${instructor.would_take_again}%` : `N/A`} + + Would take again + + + {instructor?.ratings_count ? instructor.ratings_count : `N/A`} + Ratings count + + + + {instructor?.tags && ( + <> +

+ Tags +

+ + {instructor.tags.split(",").map((tag) => ( + {tag} + ))} + )} - - - {instructor ? ( - <> - - - {instructor?.quality_rating ? ( - - {instructor.quality_rating} - - ) : ( - "N/A" - )} - - RMP Score - - - - {instructor?.difficulty_rating ? ( - - {instructor.difficulty_rating} - - ) : ( - "N/A" - )} - - Level of difficulty - - - - {instructor?.would_take_again ? `${instructor.would_take_again}%` : `N/A`} - - Would take again - - - {instructor?.ratings_count ? instructor.ratings_count : `N/A`} - Ratings count - - - ) : null} - - - {instructor?.tags && ( - <> -

Tags

- - {instructor.tags.split(",").map((tag) => ( - {tag} - ))} - - - )} - + + + + ) : ( + No data available + )} ); }