From dc0a44239666c6f96321d25a1a8e0cc07af83b69 Mon Sep 17 00:00:00 2001 From: RithwikChittineni Date: Fri, 8 Nov 2024 18:34:50 -0600 Subject: [PATCH 1/2] shifted positioning --- .../SearchResultsTable/searchResultsTable.tsx | 45 ++++++++++++------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/src/components/common/SearchResultsTable/searchResultsTable.tsx b/src/components/common/SearchResultsTable/searchResultsTable.tsx index 38f5ac63..b08ed5fa 100644 --- a/src/components/common/SearchResultsTable/searchResultsTable.tsx +++ b/src/components/common/SearchResultsTable/searchResultsTable.tsx @@ -13,6 +13,7 @@ import { TableRow, Tooltip, Typography, + useMediaQuery } from '@mui/material'; import React, { useState } from 'react'; @@ -97,6 +98,8 @@ function Row({ color, }: RowProps) { const [open, setOpen] = useState(false); + const isSmallScreen = useMediaQuery('(max-width:600px)'); + const rainbowColors = useRainbowColors(); const gpaToColor = (gpa: number): string => { @@ -137,6 +140,16 @@ function Row({ + {isSmallScreen && ( + + {searchQueryLabel(convertToProfOnly(course))} + + )} - - e.stopPropagation() // prevents opening/closing the card when clicking on the text - } - className="leading-tight text-lg text-gray-600 dark:text-gray-200 cursor-text" - > - {searchQueryLabel(course) + - ((typeof course.profFirst === 'undefined' && - typeof course.profLast === 'undefined') || - (typeof course.prefix === 'undefined' && - typeof course.number === 'undefined') - ? ' (Overall)' - : '')} - - + {!isSmallScreen && ( + + e.stopPropagation()} // prevents opening/closing the card when clicking on the text + className="leading-tight text-lg text-gray-600 dark:text-gray-200 cursor-text" + > + {searchQueryLabel(course) + + ((typeof course.profFirst === 'undefined' && + typeof course.profLast === 'undefined') || + (typeof course.prefix === 'undefined' && + typeof course.number === 'undefined') + ? ' (Overall)' + : '')} + + +)} {((typeof grades === 'undefined' || grades.state === 'error') && ( <> From d9461898d9e03883c9987100d6201ef3aea386be Mon Sep 17 00:00:00 2001 From: RithwikChittineni Date: Fri, 8 Nov 2024 18:53:10 -0600 Subject: [PATCH 2/2] ran format --- .../SearchResultsTable/searchResultsTable.tsx | 39 +++++++++---------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/src/components/common/SearchResultsTable/searchResultsTable.tsx b/src/components/common/SearchResultsTable/searchResultsTable.tsx index b08ed5fa..2aa621e4 100644 --- a/src/components/common/SearchResultsTable/searchResultsTable.tsx +++ b/src/components/common/SearchResultsTable/searchResultsTable.tsx @@ -13,7 +13,7 @@ import { TableRow, Tooltip, Typography, - useMediaQuery + useMediaQuery, } from '@mui/material'; import React, { useState } from 'react'; @@ -100,7 +100,6 @@ function Row({ const [open, setOpen] = useState(false); const isSmallScreen = useMediaQuery('(max-width:600px)'); - const rainbowColors = useRainbowColors(); const gpaToColor = (gpa: number): string => { if (gpa >= 4.0) return rainbowColors[1]; @@ -140,14 +139,14 @@ function Row({ - {isSmallScreen && ( + {isSmallScreen && ( - {searchQueryLabel(convertToProfOnly(course))} + {searchQueryLabel(convertToProfOnly(course))} )} {!isSmallScreen && ( - - e.stopPropagation()} // prevents opening/closing the card when clicking on the text - className="leading-tight text-lg text-gray-600 dark:text-gray-200 cursor-text" - > - {searchQueryLabel(course) + - ((typeof course.profFirst === 'undefined' && - typeof course.profLast === 'undefined') || - (typeof course.prefix === 'undefined' && - typeof course.number === 'undefined') - ? ' (Overall)' - : '')} - - -)} + + e.stopPropagation()} // prevents opening/closing the card when clicking on the text + className="leading-tight text-lg text-gray-600 dark:text-gray-200 cursor-text" + > + {searchQueryLabel(course) + + ((typeof course.profFirst === 'undefined' && + typeof course.profLast === 'undefined') || + (typeof course.prefix === 'undefined' && + typeof course.number === 'undefined') + ? ' (Overall)' + : '')} + + + )} {((typeof grades === 'undefined' || grades.state === 'error') && ( <>