From 0aa469af81e7912a6b26ee1b80c5920f677b5fbd Mon Sep 17 00:00:00 2001 From: Preston Cook Date: Tue, 7 Jan 2025 14:59:15 -0600 Subject: [PATCH] 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',