From 9ccc43ca274b98e9aae847de1e298d7e25cbfcb2 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Mon, 26 Feb 2024 16:19:21 -0600 Subject: [PATCH] feat: fix icons on PopupMain and convert to tailwind (#108) * feat: fix icons on PopupMain * fix: use text-white * fix: move TestColors * fix: convert to tailwind * fix: finish moving TestColors out * chore: add path alias * chore: lint PR * feat: create storybook.ts and move tailwindColorways there --------- Co-authored-by: doprz <52579214+doprz@users.noreply.github.com> --- src/shared/util/storybook.ts | 9 ++ src/stories/components/List.stories.tsx | 5 +- .../components/PopupCourseBlock.stories.tsx | 10 +- src/views/components/PopupMain.tsx | 106 +++++------------- 4 files changed, 43 insertions(+), 87 deletions(-) create mode 100644 src/shared/util/storybook.ts diff --git a/src/shared/util/storybook.ts b/src/shared/util/storybook.ts new file mode 100644 index 00000000..8bea28a9 --- /dev/null +++ b/src/shared/util/storybook.ts @@ -0,0 +1,9 @@ +import { theme } from 'unocss/preset-mini'; + +import { getCourseColors } from './colors'; + +export const tailwindColorways = Object.keys(theme.colors) + // check that the color is a colorway (is an object) + .filter(color => typeof theme.colors[color] === 'object') + .slice(0, 17) + .map(color => getCourseColors(color as keyof typeof theme.colors)); diff --git a/src/stories/components/List.stories.tsx b/src/stories/components/List.stories.tsx index acccb87d..3714667e 100644 --- a/src/stories/components/List.stories.tsx +++ b/src/stories/components/List.stories.tsx @@ -5,8 +5,7 @@ import type { Meta, StoryObj } from '@storybook/react'; import List from '@views/components/common/List/List'; import PopupCourseBlock from '@views/components/common/PopupCourseBlock/PopupCourseBlock'; import React from 'react'; - -import { TestColors } from './PopupCourseBlock.stories'; +import { tailwindColorways } from 'src/shared/util/storybook'; const numberOfCourses = 5; @@ -71,7 +70,7 @@ export const GenerateCourses = count => { const exampleCourses = GenerateCourses(numberOfCourses); const generateCourseBlocks = (exampleCourses, colors) => exampleCourses.map((course, i) => ); -export const ExampleCourseBlocks = generateCourseBlocks(exampleCourses, TestColors); +export const ExampleCourseBlocks = generateCourseBlocks(exampleCourses, tailwindColorways); const meta = { title: 'Components/Common/List', diff --git a/src/stories/components/PopupCourseBlock.stories.tsx b/src/stories/components/PopupCourseBlock.stories.tsx index fa43f65d..be5b8e69 100644 --- a/src/stories/components/PopupCourseBlock.stories.tsx +++ b/src/stories/components/PopupCourseBlock.stories.tsx @@ -5,7 +5,7 @@ import { getCourseColors } from '@shared/util/colors'; import type { Meta, StoryObj } from '@storybook/react'; import PopupCourseBlock from '@views/components/common/PopupCourseBlock/PopupCourseBlock'; import React from 'react'; -import { theme } from 'unocss/preset-mini'; +import { tailwindColorways } from 'src/shared/util/storybook'; /** * Represents an example course. @@ -101,16 +101,10 @@ export const Variants: Story = { ), }; -export const TestColors = Object.keys(theme.colors) - // check that the color is a colorway (is an object) - .filter(color => typeof theme.colors[color] === 'object') - .slice(0, 17) - .map(color => getCourseColors(color as keyof typeof theme.colors)); - export const AllColors: Story = { render: props => (
- {TestColors.map((color, i) => ( + {tailwindColorways.map((color, i) => ( ))}
diff --git a/src/views/components/PopupMain.tsx b/src/views/components/PopupMain.tsx index 808aa0f7..4d5ca71e 100644 --- a/src/views/components/PopupMain.tsx +++ b/src/views/components/PopupMain.tsx @@ -10,8 +10,11 @@ import { handleOpenCalendar } from '@views/components/injected/CourseCatalogInje import useSchedules from '@views/hooks/useSchedules'; import { openTabFromContentScript } from '@views/lib/openNewTabFromContentScript'; import React from 'react'; -import { FaCalendarAlt, FaCog, FaRedo } from 'react-icons/fa'; // Added FaRedo for the refresh icon -import { TestColors } from 'src/stories/components/PopupCourseBlock.stories'; +import { tailwindColorways } from 'src/shared/util/storybook'; + +import CalendarIcon from '~icons/material-symbols/calendar-month'; +import RefreshIcon from '~icons/material-symbols/refresh'; +import SettingsIcon from '~icons/material-symbols/settings'; /** * Renders the main popup component. @@ -21,7 +24,7 @@ export default function PopupMain() { const [activeSchedule] = useSchedules(); const draggableElements = activeSchedule?.courses.map((course, i) => ( - + )); const handleOpenOptions = async () => { @@ -32,59 +35,36 @@ export default function PopupMain() { return ( -
+
- Logo + Logo
- + UT Registration - + Plus
- -
- -
- + +
+ MAIN SCHEDULE: -
- - 22 HOURS - - - 8 Courses - +
+ 22 HOURS + 8 Courses
{/* Integrate the List component here */} @@ -97,49 +77,25 @@ export default function PopupMain() { gap={12} // Spacing between items /> ) : null} -
-
-
+
+
+
WAITLISTED
-
-
+
+
CLOSED
-
-
+
+
@@ -148,11 +104,9 @@ export default function PopupMain() {
-
- - DATA UPDATED ON: 12:00 AM 02/01/2024 - - +
+ DATA UPDATED ON: 12:00 AM 02/01/2024 +