Skip to content

Commit

Permalink
Merge branch 'main' into derek/injectedAddButton3
Browse files Browse the repository at this point in the history
  • Loading branch information
doprz authored Jan 18, 2025
2 parents 30ec43b + a20332e commit 7ae2771
Show file tree
Hide file tree
Showing 17 changed files with 198 additions and 61 deletions.
64 changes: 60 additions & 4 deletions src/stories/components/Button.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,62 @@ export const Default: Story = {
},
};

export const Small: Story = {
// @ts-ignore
args: {
children: '',
},
render: props => (
<div style={{ display: 'flex', flexDirection: 'column', gap: '15px' }}>
<div style={{ display: 'flex', gap: '15px' }}>
<Button {...props} variant='filled' color='ut-black' size='small'>
Button
</Button>
<Button {...props} variant='outline' color='ut-black' size='small'>
Button
</Button>
<Button {...props} variant='minimal' color='ut-black' size='small'>
Button
</Button>
</div>
<hr />
<div style={{ display: 'flex', gap: '15px' }}>
<Button {...props} icon={ImageSquare} variant='filled' color='ut-black' size='small' />
<Button {...props} icon={ImageSquare} variant='outline' color='ut-black' size='small' />
<Button {...props} icon={ImageSquare} variant='minimal' color='ut-black' size='small' />
</div>
</div>
),
};

export const Mini: Story = {
// @ts-ignore
args: {
children: '',
},
render: props => (
<div style={{ display: 'flex', flexDirection: 'column', gap: '15px' }}>
<div style={{ display: 'flex', gap: '15px' }}>
<Button {...props} variant='filled' color='ut-black' size='mini'>
Button
</Button>
<Button {...props} variant='outline' color='ut-black' size='mini'>
Button
</Button>
<Button {...props} variant='minimal' color='ut-black' size='mini'>
Button
</Button>
</div>
<hr />
<div style={{ display: 'flex', gap: '15px' }}>
<Button {...props} icon={ImageSquare} variant='filled' color='ut-black' size='mini' />
<Button {...props} icon={ImageSquare} variant='outline' color='ut-black' size='mini' />
<Button {...props} icon={ImageSquare} variant='minimal' color='ut-black' size='mini' />
</div>
</div>
),
};

export const Disabled: Story = {
args: {
variant: 'filled',
Expand All @@ -50,15 +106,15 @@ export const Grid: Story = {
<div style={{ display: 'flex', gap: '15px' }}>
<Button {...props} variant='filled' color='ut-black' />
<Button {...props} variant='outline' color='ut-black' />
<Button {...props} variant='single' color='ut-black' />
<Button {...props} variant='minimal' color='ut-black' />
</div>

<hr />

<div style={{ display: 'flex', gap: '15px' }}>
<Button {...props} variant='filled' color='ut-black' disabled />
<Button {...props} variant='outline' color='ut-black' disabled />
<Button {...props} variant='single' color='ut-black' disabled />
<Button {...props} variant='minimal' color='ut-black' disabled />
</div>
</div>
),
Expand All @@ -82,12 +138,12 @@ export const PrettyColors: Story = {
<Button {...props} variant='outline' color={color}>
Button
</Button>
<Button {...props} variant='single' color={color}>
<Button {...props} variant='minimal' color={color}>
Button
</Button>
<Button {...props} variant='filled' color={color} />
<Button {...props} variant='outline' color={color} />
<Button {...props} variant='single' color={color} />
<Button {...props} variant='minimal' color={color} />
</div>
))}
</div>
Expand Down
62 changes: 59 additions & 3 deletions src/stories/components/FileUpload.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,62 @@ export const Default: Story = {
},
};

export const Small: Story = {
// @ts-ignore
args: {
children: '',
},
render: props => (
<div style={{ display: 'flex', flexDirection: 'column', gap: '15px' }}>
<div style={{ display: 'flex', gap: '15px' }}>
<FileUpload {...props} variant='filled' color='ut-black' size='small'>
Upload File
</FileUpload>
<FileUpload {...props} variant='outline' color='ut-black' size='small'>
Upload File
</FileUpload>
<FileUpload {...props} variant='minimal' color='ut-black' size='small'>
Upload File
</FileUpload>
</div>
<hr />
<div style={{ display: 'flex', gap: '15px' }}>
<FileUpload {...props} icon={ImageSquare} variant='filled' color='ut-black' size='small' />
<FileUpload {...props} icon={ImageSquare} variant='outline' color='ut-black' size='small' />
<FileUpload {...props} icon={ImageSquare} variant='minimal' color='ut-black' size='small' />
</div>
</div>
),
};

export const Mini: Story = {
// @ts-ignore
args: {
children: '',
},
render: props => (
<div style={{ display: 'flex', flexDirection: 'column', gap: '15px' }}>
<div style={{ display: 'flex', gap: '15px' }}>
<FileUpload {...props} variant='filled' color='ut-black' size='mini'>
Button
</FileUpload>
<FileUpload {...props} variant='outline' color='ut-black' size='mini'>
Button
</FileUpload>
<FileUpload {...props} variant='minimal' color='ut-black' size='mini'>
Button
</FileUpload>
</div>
<hr />
<div style={{ display: 'flex', gap: '15px' }}>
<FileUpload {...props} icon={ImageSquare} variant='filled' color='ut-black' size='mini' />
<FileUpload {...props} icon={ImageSquare} variant='outline' color='ut-black' size='mini' />
<FileUpload {...props} icon={ImageSquare} variant='minimal' color='ut-black' size='mini' />
</div>
</div>
),
};

export const Disabled: Story = {
args: {
variant: 'filled',
Expand All @@ -60,15 +116,15 @@ export const Grid: Story = {
<div style={{ display: 'flex', gap: '15px' }}>
<FileUpload {...props} variant='filled' color='ut-black' />
<FileUpload {...props} variant='outline' color='ut-black' />
<FileUpload {...props} variant='single' color='ut-black' />
<FileUpload {...props} variant='minimal' color='ut-black' />
</div>

<hr />

<div style={{ display: 'flex', gap: '15px' }}>
<FileUpload {...props} variant='filled' color='ut-black' disabled />
<FileUpload {...props} variant='outline' color='ut-black' disabled />
<FileUpload {...props} variant='single' color='ut-black' disabled />
<FileUpload {...props} variant='minimal' color='ut-black' disabled />
</div>
</div>
),
Expand All @@ -92,7 +148,7 @@ export const PrettyColors: Story = {
<FileUpload {...props} variant='outline' color={color}>
Button
</FileUpload>
<FileUpload {...props} variant='single' color={color}>
<FileUpload {...props} variant='minimal' color={color}>
Button
</FileUpload>
</div>
Expand Down
10 changes: 5 additions & 5 deletions src/stories/components/Prompt.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ export const AreYouSure: StoryObj<PromptDialogProps> = {
</Text>
),
children: [
<Button key='yes' variant='single' color='ut-burntorange'>
<Button key='yes' variant='minimal' color='ut-burntorange'>
Yes
</Button>,
<Button key='no' variant='single' color='ut-black'>
<Button key='no' variant='minimal' color='ut-black'>
No
</Button>,
],
Expand All @@ -76,7 +76,7 @@ export const YouHave10ActiveSchedules: StoryObj<PromptDialogProps> = {
</Text>
),
children: [
<Button key='yes' variant='single' color='ut-black'>
<Button key='yes' variant='minimal' color='ut-black'>
I understand
</Button>,
],
Expand All @@ -94,10 +94,10 @@ export const WelcomeToUTRPV2: StoryObj<PromptDialogProps> = {
</Text>
),
children: [
<Button key='migrate' variant='single' color='ut-black'>
<Button key='migrate' variant='minimal' color='ut-black'>
Don&apos;t Migrate
</Button>,
<Button key='start-fresh' variant='single' color='ut-burntorange'>
<Button key='start-fresh' variant='minimal' color='ut-burntorange'>
Migrate
</Button>,
],
Expand Down
28 changes: 12 additions & 16 deletions src/views/components/PopupMain.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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';
Expand Down Expand Up @@ -91,15 +89,14 @@ export default function PopupMain(): JSX.Element {
<div className='flex items-center justify-between bg-white'>
<SmallLogo />
<div className='flex items-center gap-2.5'>
<button className='bg-ut-burntorange px-2 py-1.25 btn' onClick={handleCalendarOpenOnClick}>
<CalendarDots className='size-6 text-white' />
</button>
<button className='bg-transparent px-2 py-1.25 btn' onClick={handleOpenOptions}>
<GearSix className='size-6 color-ut-black' />
</button>
<button className='bg-transparent px-2 py-1.25 btn' onClick={openReportWindow}>
<Feedback className='size-6 color-ut-black' />
</button>
<Button
variant='filled'
color='ut-burntorange'
onClick={handleCalendarOpenOnClick}
icon={CalendarDots}
/>
<Button variant='minimal' color='ut-black' onClick={handleOpenOptions} icon={GearSix} />
<Button variant='minimal' color='ut-black' onClick={openReportWindow} icon={Flag} />
</div>
</div>
</div>
Expand Down Expand Up @@ -132,12 +129,11 @@ export default function PopupMain(): JSX.Element {
<div className='bottom-0 right-0 mt-2.5 w-full flex justify-end'>
<Button
variant='filled'
size='mini'
color='ut-burntorange'
className='h-fit p-0 btn'
onClick={handleAddSchedule}
>
<Plus className='h-6 w-6' />
</Button>
icon={Plus}
/>
</div>
</ScheduleDropdown>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/views/components/calendar/CalendarBottomBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ export default function CalendarBottomBar({ courseCells, setCourse }: CalendarBo
</div>
<div className='flex items-center screenshot:hidden'>
{displayCourses && <Divider orientation='vertical' size='1rem' className='mx-1.25' />}
<Button variant='single' color='ut-black' icon={CalendarDots} onClick={saveAsCal}>
<Button variant='minimal' color='ut-black' icon={CalendarDots} onClick={saveAsCal}>
Save as .CAL
</Button>
<Divider orientation='vertical' size='1rem' className='mx-1.25' />
<Button
variant='single'
variant='minimal'
color='ut-black'
icon={ImageSquare}
onClick={() => requestAnimationFrame(() => saveCalAsPng())}
Expand Down
4 changes: 2 additions & 2 deletions src/views/components/calendar/CalendarHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default function CalendarHeader({ onSidebarToggle }: CalendarHeaderProps)
return (
<div className='flex items-center gap-5 overflow-x-auto overflow-y-hidden border-b border-ut-offwhite px-7 py-4 md:overflow-x-hidden'>
<Button
variant='single'
variant='minimal'
icon={Sidebar}
color='ut-gray'
onClick={onSidebarToggle}
Expand All @@ -83,7 +83,7 @@ export default function CalendarHeader({ onSidebarToggle }: CalendarHeaderProps)

{/* <Button variant='single' icon={UndoIcon} color='ut-black' />
<Button variant='single' icon={RedoIcon} color='ut-black' /> */}
<Button variant='single' icon={GearSix} color='theme-black' onClick={handleOpenOptions} />
<Button variant='minimal' icon={GearSix} color='theme-black' onClick={handleOpenOptions} />
</div>
</div>
);
Expand Down
4 changes: 1 addition & 3 deletions src/views/components/calendar/CalendarSchedules.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ export function CalendarSchedules() {
<Text variant='h3' className='text-nowrap'>
MY SCHEDULES
</Text>
<Button variant='single' color='theme-black' className='h-fit p-0 btn' onClick={handleAddSchedule}>
<Plus className='h-6 w-6' />
</Button>
<Button size='mini' variant='minimal' color='theme-black' onClick={handleAddSchedule} icon={Plus} />
</div>
<div className='flex flex-col space-y-2.5'>
<List
Expand Down
25 changes: 17 additions & 8 deletions src/views/components/common/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import React from 'react';
interface Props {
className?: string;
style?: React.CSSProperties;
variant: 'filled' | 'outline' | 'single';
variant?: 'filled' | 'outline' | 'minimal';
size?: 'regular' | 'small' | 'mini';
onClick?: () => void;
icon?: Icon;
iconProps?: IconProps;
Expand All @@ -24,7 +25,8 @@ interface Props {
export function Button({
className,
style,
variant,
variant = 'filled',
size = 'regular',
onClick,
icon,
iconProps,
Expand Down Expand Up @@ -52,11 +54,15 @@ export function Button({
{
'text-white! bg-opacity-100 hover:enabled:shadow-md active:enabled:shadow-sm shadow-black/20':
variant === 'filled',
'bg-opacity-0 border-current hover:enabled:bg-opacity-8 border': variant === 'outline',
'bg-opacity-0 border-none hover:enabled:bg-opacity-8': variant === 'single', // settings is the only "single"
'px-2 py-1.25': isIconOnly && variant !== 'outline',
'px-1.75 py-1.25': isIconOnly && variant === 'outline',
'px-3.75': variant === 'outline' && !isIconOnly,
'bg-opacity-0 border-current hover:enabled:bg-opacity-8 border stroke-width-[1px]':
variant === 'outline',
'bg-opacity-0 border-none hover:enabled:bg-opacity-8': variant === 'minimal',
'h-10 gap-spacing-3 px-spacing-5': size === 'regular' && !isIconOnly,
'h-10 w-10 p-spacing-2': size === 'regular' && isIconOnly,
'h-[35px] gap-spacing-3 px-spacing-3': size === 'small' && !isIconOnly,
'h-[35px] w-[35px] p-spacing-2': size === 'small' && isIconOnly,
'h-6 p-spacing-2': size === 'mini' && !isIconOnly,
'h-6 w-6 p-0': size === 'mini' && isIconOnly,
},
className
)}
Expand All @@ -66,7 +72,10 @@ export function Button({
>
{Icon && <Icon {...iconProps} className={clsx('h-6 w-6', iconProps?.className)} />}
{!isIconOnly && (
<Text variant='h4' className='inline-flex translate-y-0.08 items-center gap-2'>
<Text
variant={size === 'regular' ? 'h4' : 'small'}
className='inline-flex translate-y-0.08 items-center gap-2'
>
{children}
</Text>
)}
Expand Down
Loading

0 comments on commit 7ae2771

Please sign in to comment.