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 <sgunter@utexas.edu>
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import splashText from '@assets/insideJokes';
|
import splashText from '@assets/insideJokes';
|
||||||
import createSchedule from '@pages/background/lib/createSchedule';
|
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 { background } from '@shared/messages';
|
||||||
import { initSettings, OptionsStore } from '@shared/storage/OptionsStore';
|
import { initSettings, OptionsStore } from '@shared/storage/OptionsStore';
|
||||||
import { UserScheduleStore } from '@shared/storage/UserScheduleStore';
|
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 useKC_DABR_WASM from 'kc-dabr-wasm';
|
||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
|
|
||||||
import Feedback from '~icons/material-symbols/flag';
|
|
||||||
|
|
||||||
import { Button } from './common/Button';
|
import { Button } from './common/Button';
|
||||||
import CourseStatus from './common/CourseStatus';
|
import CourseStatus from './common/CourseStatus';
|
||||||
import { SmallLogo } from './common/LogoIcon';
|
import { SmallLogo } from './common/LogoIcon';
|
||||||
@@ -91,15 +89,14 @@ export default function PopupMain(): JSX.Element {
|
|||||||
<div className='flex items-center justify-between bg-white'>
|
<div className='flex items-center justify-between bg-white'>
|
||||||
<SmallLogo />
|
<SmallLogo />
|
||||||
<div className='flex items-center gap-2.5'>
|
<div className='flex items-center gap-2.5'>
|
||||||
<button className='bg-ut-burntorange px-2 py-1.25 btn' onClick={handleCalendarOpenOnClick}>
|
<Button
|
||||||
<CalendarDots className='size-6 text-white' />
|
variant='filled'
|
||||||
</button>
|
color='ut-burntorange'
|
||||||
<button className='bg-transparent px-2 py-1.25 btn' onClick={handleOpenOptions}>
|
onClick={handleCalendarOpenOnClick}
|
||||||
<GearSix className='size-6 color-ut-black' />
|
icon={CalendarDots}
|
||||||
</button>
|
/>
|
||||||
<button className='bg-transparent px-2 py-1.25 btn' onClick={openReportWindow}>
|
<Button variant='minimal' color='ut-black' onClick={handleOpenOptions} icon={GearSix} />
|
||||||
<Feedback className='size-6 color-ut-black' />
|
<Button variant='minimal' color='ut-black' onClick={openReportWindow} icon={Flag} />
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ function Item<T>(props: {
|
|||||||
{...props.provided.draggableProps}
|
{...props.provided.draggableProps}
|
||||||
ref={props.provided.innerRef}
|
ref={props.provided.innerRef}
|
||||||
style={getStyle(props.provided, props.style)}
|
style={getStyle(props.provided, props.style)}
|
||||||
className={props.isDragging ? 'is-dragging' : ''}
|
className={props.isDragging ? 'group is-dragging' : ''}
|
||||||
>
|
>
|
||||||
{props.children}
|
{props.children}
|
||||||
</div>
|
</div>
|
||||||
@@ -104,7 +104,7 @@ function List<T>({ draggables, itemKey, children, onReordered, gap }: ListProps<
|
|||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div style={{ overflow: 'hidden' }}>
|
<div style={{ overflow: 'clip', overflowClipMargin: `${gap}px` }}>
|
||||||
<DragDropContext onDragEnd={onDragEnd}>
|
<DragDropContext onDragEnd={onDragEnd}>
|
||||||
<Droppable
|
<Droppable
|
||||||
droppableId='droppable'
|
droppableId='droppable'
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import { pickFontColor } from '@shared/util/colors';
|
|||||||
import { StatusIcon } from '@shared/util/icons';
|
import { StatusIcon } from '@shared/util/icons';
|
||||||
import Text from '@views/components/common/Text/Text';
|
import Text from '@views/components/common/Text/Text';
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useRef, useState } from 'react';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Props for PopupCourseBlock
|
* Props for PopupCourseBlock
|
||||||
@@ -37,6 +37,7 @@ export default function PopupCourseBlock({
|
|||||||
dragHandleProps,
|
dragHandleProps,
|
||||||
}: PopupCourseBlockProps): JSX.Element {
|
}: PopupCourseBlockProps): JSX.Element {
|
||||||
const [enableCourseStatusChips, setEnableCourseStatusChips] = useState<boolean>(false);
|
const [enableCourseStatusChips, setEnableCourseStatusChips] = useState<boolean>(false);
|
||||||
|
const ref = useRef<HTMLDivElement>(null);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
initSettings().then(({ enableCourseStatusChips }) => setEnableCourseStatusChips(enableCourseStatusChips));
|
initSettings().then(({ enableCourseStatusChips }) => setEnableCourseStatusChips(enableCourseStatusChips));
|
||||||
@@ -46,6 +47,17 @@ export default function PopupCourseBlock({
|
|||||||
// console.log('enableCourseStatusChips', newValue);
|
// 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 () => {
|
return () => {
|
||||||
OptionsStore.removeListener(l1);
|
OptionsStore.removeListener(l1);
|
||||||
};
|
};
|
||||||
@@ -66,10 +78,11 @@ export default function PopupCourseBlock({
|
|||||||
backgroundColor: colors.primaryColor,
|
backgroundColor: colors.primaryColor,
|
||||||
}}
|
}}
|
||||||
className={clsx(
|
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
|
className
|
||||||
)}
|
)}
|
||||||
onClick={handleClick}
|
onClick={handleClick}
|
||||||
|
ref={ref}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
|
|||||||
Reference in New Issue
Block a user