From 0aa469af81e7912a6b26ee1b80c5920f677b5fbd Mon Sep 17 00:00:00 2001 From: Preston Cook Date: Tue, 7 Jan 2025 14:59:15 -0600 Subject: [PATCH 1/2] feat(ui): update button variants following figma (#482) * feat(ui): update button variants following figma * feat(ui): separate size prop to allow for regular and small sized button variants * update type to no longer include minimal-small * update uno css config to use new spacing system * add variants and sizes to file upload; update button and file upload stories * add mini button variant and update small button * specify width on icon-only regular variant * update plus buttons to be mini sizes * remove redundant classnames --------- Co-authored-by: doprz <52579214+doprz@users.noreply.github.com> --- src/stories/components/Button.stories.tsx | 64 +++++++++++++++++-- src/stories/components/FileUpload.stories.tsx | 62 +++++++++++++++++- src/stories/components/Prompt.stories.tsx | 10 +-- src/views/components/PopupMain.tsx | 7 +- .../components/calendar/CalendarBottomBar.tsx | 4 +- .../components/calendar/CalendarHeader.tsx | 4 +- .../components/calendar/CalendarSchedules.tsx | 4 +- src/views/components/common/Button.tsx | 25 +++++--- src/views/components/common/FileUpload.tsx | 25 +++++--- .../components/common/MigrationDialog.tsx | 2 +- .../components/common/ScheduleListItem.tsx | 2 +- .../HeadingAndActions.tsx | 2 +- src/views/components/settings/Settings.tsx | 2 +- src/views/hooks/useChangelog.tsx | 2 +- unocss.config.ts | 2 +- 15 files changed, 172 insertions(+), 45 deletions(-) diff --git a/src/stories/components/Button.stories.tsx b/src/stories/components/Button.stories.tsx index e61683af..1fcf666b 100644 --- a/src/stories/components/Button.stories.tsx +++ b/src/stories/components/Button.stories.tsx @@ -35,6 +35,62 @@ export const Default: Story = { }, }; +export const Small: Story = { + // @ts-ignore + args: { + children: '', + }, + render: props => ( +
+
+ + + +
+
+
+
+
+ ), +}; + +export const Mini: Story = { + // @ts-ignore + args: { + children: '', + }, + render: props => ( +
+
+ + + +
+
+
+
+
+ ), +}; + export const Disabled: Story = { args: { variant: 'filled', @@ -50,7 +106,7 @@ export const Grid: Story = {

@@ -58,7 +114,7 @@ export const Grid: Story = {
), @@ -82,12 +138,12 @@ export const PrettyColors: Story = { - , - , ], @@ -76,7 +76,7 @@ export const YouHave10ActiveSchedules: StoryObj = { ), children: [ - , ], @@ -94,10 +94,10 @@ export const WelcomeToUTRPV2: StoryObj = { ), children: [ - , - , ], diff --git a/src/views/components/PopupMain.tsx b/src/views/components/PopupMain.tsx index 35a54cf0..e47594de 100644 --- a/src/views/components/PopupMain.tsx +++ b/src/views/components/PopupMain.tsx @@ -132,12 +132,11 @@ export default function PopupMain(): JSX.Element {
+ icon={Plus} + />
diff --git a/src/views/components/calendar/CalendarBottomBar.tsx b/src/views/components/calendar/CalendarBottomBar.tsx index 4b650ec9..4d140620 100644 --- a/src/views/components/calendar/CalendarBottomBar.tsx +++ b/src/views/components/calendar/CalendarBottomBar.tsx @@ -60,12 +60,12 @@ export default function CalendarBottomBar({ courseCells, setCourse }: CalendarBo
{displayCourses && } -
); diff --git a/src/views/components/calendar/CalendarSchedules.tsx b/src/views/components/calendar/CalendarSchedules.tsx index 767a6d30..e64674fd 100644 --- a/src/views/components/calendar/CalendarSchedules.tsx +++ b/src/views/components/calendar/CalendarSchedules.tsx @@ -31,9 +31,7 @@ export function CalendarSchedules() { MY SCHEDULES - + diff --git a/unocss.config.ts b/unocss.config.ts index 9025e7b6..5893b0c0 100644 --- a/unocss.config.ts +++ b/unocss.config.ts @@ -26,7 +26,7 @@ export default defineConfig({ ], shortcuts: { focusable: 'outline-none ring-blue-500/50 dark:ring-blue-400/60 ring-0 focus-visible:ring-4', - btn: 'h-10 w-auto flex cursor-pointer justify-center items-center gap-2 rounded-1 px-4 py-0 text-4.5 btn-transition disabled:(cursor-not-allowed opacity-50) active:enabled:scale-96 focusable', + btn: 'h-10 w-auto flex cursor-pointer justify-center items-center gap-spacing-3 rounded-1 px-spacing-5 py-0 text-4.5 btn-transition disabled:(cursor-not-allowed opacity-50) active:enabled:scale-96 focusable', link: 'text-ut-burntorange link:text-ut-burntorange underline underline-offset-2 hover:text-ut-orange focus-visible:text-ut-orange focusable btn-transition ease-out-expo', linkanimate: 'relative cursor-pointer transition duration-100 ease-out after:(absolute left-0.4 right-0.4 h-2px scale-x-95 bg-ut-orange opacity-0 transition duration-250 ease-out-expo content-empty -bottom-0.75 -translate-y-0.5) active:scale-95 hover:text-ut-orange focus-visible:text-ut-orange hover:after:(opacity-100) !hover:after:translate-y-0 !hover:after:scale-x-100', From a20332e53da9bda873fabb8395afe6ff6303799c Mon Sep 17 00:00:00 2001 From: Aaron Chen <86327871+aaronthechen@users.noreply.github.com> Date: Wed, 8 Jan 2025 02:20:10 -0600 Subject: [PATCH 2/2] feat(ui): added shadows to popup buttons and course blocks (#378) * feat(ui): added shadows to popup buttons and course blocks * feat(ui): keep shadow state while dragging course block * feat(ui): fixed transition "flash" after dragging * feat(ui): fix linting/styling * Update src/views/components/PopupMain.tsx Co-authored-by: Samuel Gunter <29130894+Samathingamajig@users.noreply.github.com> * fix(ui): change old icons to the new ones from main * fix(ui): show flag icon instead of plus icon for feedback * chore: fix button variants after merge --------- Co-authored-by: doprz <52579214+doprz@users.noreply.github.com> Co-authored-by: Samuel Gunter <29130894+Samathingamajig@users.noreply.github.com> Co-authored-by: Samuel Gunter --- src/views/components/PopupMain.tsx | 21 ++++++++----------- src/views/components/common/List.tsx | 4 ++-- .../components/common/PopupCourseBlock.tsx | 17 +++++++++++++-- 3 files changed, 26 insertions(+), 16 deletions(-) diff --git a/src/views/components/PopupMain.tsx b/src/views/components/PopupMain.tsx index e47594de..2fd13f72 100644 --- a/src/views/components/PopupMain.tsx +++ b/src/views/components/PopupMain.tsx @@ -1,6 +1,6 @@ import splashText from '@assets/insideJokes'; import createSchedule from '@pages/background/lib/createSchedule'; -import { CalendarDots, GearSix, Plus } from '@phosphor-icons/react'; +import { CalendarDots, Flag, GearSix, Plus } from '@phosphor-icons/react'; import { background } from '@shared/messages'; import { initSettings, OptionsStore } from '@shared/storage/OptionsStore'; import { UserScheduleStore } from '@shared/storage/UserScheduleStore'; @@ -14,8 +14,6 @@ import { getUpdatedAtDateTimeString } from '@views/lib/getUpdatedAtDateTimeStrin import useKC_DABR_WASM from 'kc-dabr-wasm'; import React, { useEffect, useState } from 'react'; -import Feedback from '~icons/material-symbols/flag'; - import { Button } from './common/Button'; import CourseStatus from './common/CourseStatus'; import { SmallLogo } from './common/LogoIcon'; @@ -91,15 +89,14 @@ export default function PopupMain(): JSX.Element {
- - - +
diff --git a/src/views/components/common/List.tsx b/src/views/components/common/List.tsx index 267d7e29..78b90c58 100644 --- a/src/views/components/common/List.tsx +++ b/src/views/components/common/List.tsx @@ -59,7 +59,7 @@ function Item(props: { {...props.provided.draggableProps} ref={props.provided.innerRef} style={getStyle(props.provided, props.style)} - className={props.isDragging ? 'is-dragging' : ''} + className={props.isDragging ? 'group is-dragging' : ''} > {props.children} @@ -104,7 +104,7 @@ function List({ draggables, itemKey, children, onReordered, gap }: ListProps< ); return ( -
+
(false); + const ref = useRef(null); useEffect(() => { initSettings().then(({ enableCourseStatusChips }) => setEnableCourseStatusChips(enableCourseStatusChips)); @@ -46,6 +47,17 @@ export default function PopupCourseBlock({ // console.log('enableCourseStatusChips', newValue); }); + // adds transition for shadow hover after three frames + requestAnimationFrame(() => { + requestAnimationFrame(() => { + requestAnimationFrame(() => { + if (ref.current) { + ref.current.classList.add('transition-shadow-100'); + } + }); + }); + }); + return () => { OptionsStore.removeListener(l1); }; @@ -66,10 +78,11 @@ export default function PopupCourseBlock({ backgroundColor: colors.primaryColor, }} className={clsx( - 'h-full w-full inline-flex items-center justify-center gap-1 rounded pr-3 focusable cursor-pointer text-left', + 'h-full w-full inline-flex items-center justify-center gap-1 rounded pr-3 focusable cursor-pointer text-left hover:shadow-md ease-out group-[.is-dragging]:shadow-md', className )} onClick={handleClick} + ref={ref} >