Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ Prefix the change with one of these keywords:

### Added

- No image prop added and added few new styles to the card with no image

### Added

- Card animations in lieu of hover scale

## [0.26.8]
Expand Down
32 changes: 16 additions & 16 deletions docs/motion-enhancement-plan.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,23 +60,23 @@ This plan proposes a cohesive motion-and-interactivity layer for RDS. It is an _

### 2.1 Motion already in the codebase

| Component | Motion present | File:line | Notes |
| -------------------------------------- | -------------------------------------------------- | --------------------------------------------------------------------------- | ---------------------------------------------------------------- |
| Card | hover scale (1.02) + shadow | `lib/components/Card/Card.tsx:45` | `duration-300 ease-in`. No `motion-reduce` |
| Toast | slide-in + fade, JS removal after 200 ms | `lib/components/Toast/Toast.tsx:48,57` | Hard-coded timeout couples JS to CSS |
| Nav | header hide-on-scroll | `lib/components/Nav/Nav.tsx:28`, `scrollingNav.ts:12-32` | Unthrottled scroll listener; no `motion-reduce` |
| Nav | item color transitions, arrow rotation | `lib/components/Nav/Nav.Styles.ts:8-13`, `priority-plus.css:17,60` | No `motion-reduce` |
| Component | Motion present | File:line | Notes |
| -------------------------------------- | --------------------------------------------------- | --------------------------------------------------------------------------- | ---------------------------------------------------------------- |
| Card | hover scale (1.02) + shadow | `lib/components/Card/Card.tsx:45` | `duration-300 ease-in`. No `motion-reduce` |
| Toast | slide-in + fade, JS removal after 200 ms | `lib/components/Toast/Toast.tsx:48,57` | Hard-coded timeout couples JS to CSS |
| Nav | header hide-on-scroll | `lib/components/Nav/Nav.tsx:28`, `scrollingNav.ts:12-32` | Unthrottled scroll listener; no `motion-reduce` |
| Nav | item color transitions, arrow rotation | `lib/components/Nav/Nav.Styles.ts:8-13`, `priority-plus.css:17,60` | No `motion-reduce` |
| Description | accordion icon rotation (`rotate-0` ↔ `rotate-90`) | `lib/components/Description/DescriptionAccordion.tsx:27`, `script.ts` | Content shows/hides via `hidden` attribute — no height animation |
| FilterPanel | dropdown arrow rotation + color | `lib/components/FilterPanel/FilterPanelTop.tsx:34`, `dropdown.ts:66,88,141` | No `motion-reduce` |
| ProgressBar | width fill animation | `lib/components/ProgressBar/ProgressBar.tsx:31-32` | `transition-all duration-1000` — animates `width` (H3 violation) |
| ImageSlider | carousel slide (inline `transform 0.5s`) | `lib/components/ImageSlider/script.ts:78-113` | JS-set transitions; 50 ms timeouts to sequence phases |
| ImageSlider item | 5 s background-image transition | `lib/components/ImageSlider/ImageSliderItem.tsx:31` | `duration-[5000]`. Borderline H6 |
| Loaders (21+) | `animate-pulse` skeletons | `lib/components/Loaders/**` | None opt into `motion-reduce` (Tailwind does NOT auto-disable) |
| PageLoader | `animate-spin` + slowed-spin under reduced-motion | `lib/components/Loaders/PageLoader/PageLoader.tsx:5` | **Only** component currently honouring reduced-motion |
| TopNavLoader | `animate-spin` | `lib/components/Loaders/TopNavLoader/TopNavLoader.tsx:6` | No `motion-reduce` |
| Splash / FullBanner / WideBanner video | `autoPlay muted loop playsInline` | `lib/hooks/useVideoBanner.tsx:39-41` | Loops indefinitely. No pause control. **H6 risk.** |
| Modal | none (snap `block`/`hidden`) | `lib/components/Modal/Modal.tsx:129` | Open/close is instant — felt jarring per typical UX |
| Dialog | none (uses native `<dialog>` `showModal()`) | `lib/components/Dialog/Dialog.tsx:21` | Same — no entrance/exit |
| FilterPanel | dropdown arrow rotation + color | `lib/components/FilterPanel/FilterPanelTop.tsx:34`, `dropdown.ts:66,88,141` | No `motion-reduce` |
| ProgressBar | width fill animation | `lib/components/ProgressBar/ProgressBar.tsx:31-32` | `transition-all duration-1000` — animates `width` (H3 violation) |
| ImageSlider | carousel slide (inline `transform 0.5s`) | `lib/components/ImageSlider/script.ts:78-113` | JS-set transitions; 50 ms timeouts to sequence phases |
| ImageSlider item | 5 s background-image transition | `lib/components/ImageSlider/ImageSliderItem.tsx:31` | `duration-[5000]`. Borderline H6 |
| Loaders (21+) | `animate-pulse` skeletons | `lib/components/Loaders/**` | None opt into `motion-reduce` (Tailwind does NOT auto-disable) |
| PageLoader | `animate-spin` + slowed-spin under reduced-motion | `lib/components/Loaders/PageLoader/PageLoader.tsx:5` | **Only** component currently honouring reduced-motion |
| TopNavLoader | `animate-spin` | `lib/components/Loaders/TopNavLoader/TopNavLoader.tsx:6` | No `motion-reduce` |
| Splash / FullBanner / WideBanner video | `autoPlay muted loop playsInline` | `lib/hooks/useVideoBanner.tsx:39-41` | Loops indefinitely. No pause control. **H6 risk.** |
| Modal | none (snap `block`/`hidden`) | `lib/components/Modal/Modal.tsx:129` | Open/close is instant — felt jarring per typical UX |
| Dialog | none (uses native `<dialog>` `showModal()`) | `lib/components/Dialog/Dialog.tsx:21` | Same — no entrance/exit |

### 2.2 What's missing

Expand Down
5 changes: 4 additions & 1 deletion lib/components/Card/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export interface CardProps {
isCenter?: boolean
isCenterDesktop?: boolean
noHover?: boolean
noImage?: boolean
leftBorder?: boolean
isDark?: boolean
revealOnScroll?: boolean
Expand All @@ -35,6 +36,7 @@ export const CardWrapper = ({
isCenterDesktop,
isCenter,
noHover,
noImage,
leftBorder,
isDark,
revealOnScroll = true,
Expand All @@ -47,13 +49,14 @@ export const CardWrapper = ({
const centerTextDesktop = isCenterDesktop ? 'md:text-center' : ''
const hoverStyles = noHover ? '' : 'group hover:shadow-cu-black-200 dark:hover:shadow-none'
const addRedBorder = leftBorder ? 'border-l-8 border-l-cu-red' : ''
const noImageStyles = noImage ? 'cu-card--no-image' : ''

return (
<div
ref={ref}
data-cu-reveal={revealOnScroll ? '' : undefined}
data-revealed={isVisible ? 'true' : 'false'}
className={`not-prose cu-card relative rounded-lg @container md:max-w-xl flex flex-col gap-3 ${bgStyles} ${centerText} ${centerTextDesktop} ${addRedBorder} ${hoverStyles} ${isDark ? 'dark' : ''} dark:text-white dark:bg-cu-black`}
className={`not-prose cu-card relative rounded-lg @container md:max-w-xl flex flex-col gap-3 ${bgStyles} ${centerText} ${centerTextDesktop} ${addRedBorder} ${hoverStyles} ${noImageStyles} ${isDark ? 'dark' : ''} dark:text-white dark:bg-cu-black`}
>
{children}

Expand Down
37 changes: 37 additions & 0 deletions lib/components/Card/Examples.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,43 @@ export const LayoutExamples: Story = {
)}
</Column>

<PageHeader header="Event Cards — No Image" size="md" />
<Column cols="3">
{EventData.slice(0, 3).map(
({
id,
title,
link,
startDate,
endDate,
on_campus,
on_campus_building,
on_campus_room_number,
event_address,
}) => (
<Card key={id} noImage>
<Card.DateThumb startDate={startDate} endDate={endDate} />
<Card.Header title={title} />
<Card.Body>
<Card.EventMeta
startDateTime={startDate}
endDateTime={endDate}
onCampus={on_campus}
onCampusBuilding={on_campus_building}
onCampusRoomNumber={on_campus_room_number}
eventAddress={event_address}
/>
</Card.Body>
<Card.Footer>
<a href={link} className="cu-button cu-button--red cu-button--small">
More info
</a>
</Card.Footer>
</Card>
),
)}
</Column>

<SinglePara />
<SinglePara />

Expand Down
8 changes: 8 additions & 0 deletions lib/components/Card/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,14 @@
@apply mx-auto h-32 w-32 rounded-full border-4 border-white object-cover shadow-md @sm:md:h-48 @sm:md:w-48;
}

/* No image variant */
.cu-card.cu-card--no-image > h2,
.cu-card.cu-card--no-image > h3 {
margin-top: 1.25rem !important;
background-color: theme('colors.cu-black.50') !important;
box-shadow: none !important;
}

.cu-card-button a {
@apply gap-1 p-3 text-sm font-medium rounded-md md:px-6;
}
Expand Down
Loading