From f65939333516b256c65c4d227bba77b6e0217607 Mon Sep 17 00:00:00 2001 From: Mark Chiu Date: Wed, 7 Dec 2022 21:13:52 -0500 Subject: [PATCH] Add Academics page (Closes #54) (#94) Summary of noteworthy changes: - **Pie charts do NOT currently calculate percentages of values**. I left it as is, and just changed the data to reflect the percentages instead of the actual value (because that is what we're displaying) - Minor fix to the Stacked Bar Graph so that the legend displays on top in a row instead of in a column to the right of the graph. - Added styling to Carousel so that it is properly centered. - In the Stacked Bar Graphs, I grouped certain ranges of values because the value for the individual categories would have been too small and insignificant otherwise. Problems: - [x] WordCloud still doesn't display the right text-value association no matter how much I tweak the values. The font size is correctly displayed though and all words are shown (I counted!). Errors still show in the console log. - [ ] WordCloud still weirdly overflows sometimes when I resize my window. See figure below. (#98) - [ ] Stacked Bar Graph still needs some fixing (to be done in a separate PR) related to how the legend is displayed + labels. - [x] **Description blurbs NEED to be re-read before copy-pasting**. I just noticed that the given blurbs are sometimes incomplete, grammatically incorrect, or erroneous. - [ ] Bar graphs and pie charts need to have tooltips. (all graphs) (#97) - [ ] Tooltips in Stacked Bar Graphs are not well positioned when hovering over them. (#89) Co-authored-by: e26chiu Co-authored-by: shahanneda Reviewed-on: https://git.csclub.uwaterloo.ca/www/cs-2022-class-profile/pulls/94 Reviewed-by: Shahan Nedadahandeh --- components/SectionWrapper.module.css | 4 + components/SectionWrapper.tsx | 15 + components/StackedBarGraph.module.css | 1 - components/StackedBarGraph.tsx | 47 +- data/academics.ts | 1577 +++++++++++++++++++++++++ data/mocks.ts | 2 +- pages/academics.tsx | 458 +++++++ pages/samplePage.module.css | 8 + 8 files changed, 2088 insertions(+), 24 deletions(-) create mode 100644 components/SectionWrapper.module.css create mode 100644 components/SectionWrapper.tsx create mode 100644 data/academics.ts create mode 100644 pages/academics.tsx diff --git a/components/SectionWrapper.module.css b/components/SectionWrapper.module.css new file mode 100644 index 0000000..65db0fa --- /dev/null +++ b/components/SectionWrapper.module.css @@ -0,0 +1,4 @@ +.sectionWrapper h2 { + color: var(--primary-heading); + padding-left: 4rem; +} diff --git a/components/SectionWrapper.tsx b/components/SectionWrapper.tsx new file mode 100644 index 0000000..fede352 --- /dev/null +++ b/components/SectionWrapper.tsx @@ -0,0 +1,15 @@ +import React from "react"; + +import styles from "./SectionWrapper.module.css"; + +type SectionWrapperProps = { + title: string; +}; + +export function SectionWrapper({ title }: SectionWrapperProps) { + return ( +
+

{title}

+
+ ); +} diff --git a/components/StackedBarGraph.module.css b/components/StackedBarGraph.module.css index 4c25e0e..40646db 100644 --- a/components/StackedBarGraph.module.css +++ b/components/StackedBarGraph.module.css @@ -7,7 +7,6 @@ } .legend { - position: absolute; display: flex; font-size: calc(16rem / 16); top: 0; diff --git a/components/StackedBarGraph.tsx b/components/StackedBarGraph.tsx index 9b0bd44..c9f77fd 100644 --- a/components/StackedBarGraph.tsx +++ b/components/StackedBarGraph.tsx @@ -88,7 +88,7 @@ export const StackedBarGraphVertical = withTooltip< strokeDashArray = "10,4", legendLeftOffset = 40, legendTopOffset = 40, - itemMargin = "15px 0 0 0", + itemMargin = "0 0 0 15px", categoryAxisLeftFactor = 1, tooltipOpen, tooltipLeft, @@ -134,6 +134,18 @@ export const StackedBarGraphVertical = withTooltip< return width < 10 ? null : (
+
+ +
+ -
- -
{tooltipOpen && tooltipData ? ( +
+ +
+ -
- -
{tooltipOpen && tooltipData ? ( +
+ + + + + +
+ +
+
+ + +
+ +
+
+ + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + +
+ +
+
+ + +
+ +
+
+ + + + + + +
+ +
+
+ + + + + + + + + + + + + + + + + +
+ +
+
+ + +
+ +
+
+ + +
+ +
+
+ + +
+ +
+
+ + +
+ +
+
+ + +
+ +
+
+ + +
+ ); +} diff --git a/pages/samplePage.module.css b/pages/samplePage.module.css index f3761c2..5a817c9 100644 --- a/pages/samplePage.module.css +++ b/pages/samplePage.module.css @@ -8,6 +8,14 @@ padding: 0 calc(70rem / 16); } +.quotationCarouselContainer { + display: flex; + flex-direction: column; + align-items: center; + gap: calc(48rem / 16); + margin: calc(32rem / 16); +} + @media screen and (max-width: 1200px) { .graphContainer { padding: 0 calc(40rem / 16);