Skip to content

Commit 4a59078

Browse files
committed
feat: add responsive breakpoint standardization and documentation
Standardize responsive breakpoints across all components and add comprehensive documentation. **SummaryCard Button Skeleton Fix:** - Fix button skeleton showing full-width on desktop in loading states - Use CSS custom property (--button-skeleton-width) instead of inline width - Calculate dynamic width based on button text length (min 88px, max 200px) - Preserve media query behavior for responsive breakpoints **Responsive Breakpoint Standardization:** - Add design tokens for breakpoints (640px, 768px, 1024px) in tokens.css - Standardize all components to use hardcoded px values in media queries - Add inline comments (/* desktop */, /* desktop-wide */) for clarity - Document ChatGPT Desktop widget width strategy (768px) **Breakpoint Strategy:** - List component: 640px (ensures desktop layout at 768px ChatGPT widget width) - Card/SummaryCard/Album: 768px (button auto-width at ChatGPT widget size) - FullscreenMap: 1024px (sidebar only on wide screens) **Implementation Details:** - CSS variables cannot be used in @media conditions (browser limitation) - Follows industry best practices (Tailwind CSS, Bootstrap, Material-UI) - Design tokens serve as documentation reference **Storybook Documentation:** - Add "Responsive Breakpoints" page under Design Tokens - Interactive demos showing SummaryCard button width at 768px - Interactive demos showing List layout change at 640px - Live viewport width indicators for testing - ChatGPT widget strategy explanation - Implementation notes with code examples **Files Changed:** - SummaryCard: Button skeleton with CSS variable, 768px breakpoint - List: 640px breakpoint maintained - Album: 768px breakpoint with inline comments - FullscreenMap/MapSidebar: 1024px breakpoint with inline comments - tokens.css: Added breakpoint design tokens - Tokens.stories.tsx: Added ResponsiveBreakpoints story
1 parent ec80c5f commit 4a59078

15 files changed

+1145
-167
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3333
### Changed
3434

3535
- **Card Component**: Reduced spacing for more compact design
36-
- **Card Loading UI**: Improve loading UI to be responsive to smoothly transit to data state.
36+
- **Card Loading UI**: Improve loading UI to be responsive to smoothly transit to data state.
3737
- **SummaryCard**: Consolidated DiscoveryCard functionality with improved structure
3838

3939
### Fixed

packages/ui/src/Introduction.stories.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ const pizzaRestaurants: PizzaRestaurant[] = [
118118
title: 'Dough-Re-Mi',
119119
subtitle: '512 Harmony Avenue',
120120
image: 'https://persistent.oaistatic.com/pizzaz/pizzaz-4.png',
121-
description: 'Focaccia-style squares with fluffy, airy texture and perfectly crispy edges. A late-night favorite among locals who crave authentic Italian-style pizza.',
121+
description:
122+
'Focaccia-style squares with fluffy, airy texture and perfectly crispy edges. A late-night favorite among locals who crave authentic Italian-style pizza.',
122123
badge: '4.6',
123124
features: ['$$', 'Focaccia', 'Late-night'],
124125
},
@@ -582,7 +583,7 @@ const IntroductionPage = () => {
582583
badge={restaurant.badge}
583584
size="compact"
584585
imageAspectRatio="4/3"
585-
metadata={restaurant.features.map(f => ({ label: f, separator: '•' }))}
586+
metadata={restaurant.features.map((f) => ({ label: f, separator: '•' }))}
586587
description={restaurant.description}
587588
buttonText="Order now"
588589
onButtonClick={() => alert(`Order from ${restaurant.title}`)}
@@ -939,8 +940,8 @@ const IntroductionPage = () => {
939940
more
940941
</li>
941942
<li>
942-
<strong>Cards</strong>: SummaryCard (with compact variant), ImageCard, ListCard with all
943-
features
943+
<strong>Cards</strong>: SummaryCard (with compact variant), ImageCard, ListCard with
944+
all features
944945
</li>
945946
<li>
946947
<strong>Patterns</strong>: Carousel, List, Album, Map with complete examples

packages/ui/src/components/Album/AlbumViewer.module.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
z-index: 10;
4242
}
4343

44-
@media (min-width: 768px) {
44+
@media (min-width: 768px) /* desktop */ {
4545
.filmStripContainer {
4646
display: block;
4747
}
@@ -58,7 +58,7 @@
5858
overflow: hidden;
5959
}
6060

61-
@media (min-width: 768px) {
61+
@media (min-width: 768px) /* desktop */ {
6262
.photoContainer {
6363
padding: var(--ai-spacing-20);
6464
padding-left: var(--ai-spacing-16);
@@ -131,7 +131,7 @@
131131
right: var(--ai-spacing-4);
132132
}
133133

134-
@media (min-width: 768px) {
134+
@media (min-width: 768px) /* desktop */ {
135135
.navButton {
136136
display: none;
137137
}

packages/ui/src/components/Card/SummaryCard.module.css

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,10 @@
248248
flex-direction: column;
249249
align-items: stretch;
250250
/* Match description height exactly - include marginTop spacing (2px between lines) */
251-
height: calc(var(--ai-line-height-body-small) * var(--description-lines, 2) + 2px * (var(--description-lines, 2) - 1));
251+
height: calc(
252+
var(--ai-line-height-body-small) * var(--description-lines, 2) + 2px *
253+
(var(--description-lines, 2) - 1)
254+
);
252255
}
253256

254257
/* Compact size uses caption line-height - match description's actual rendered height (slightly shorter due to webkit-line-clamp) */
@@ -300,12 +303,22 @@
300303
width: 100%;
301304
}
302305

306+
/* Button skeleton wrapper - matches Button component's inline-flex behavior */
307+
.buttonSkeletonWrapper {
308+
display: inline-flex;
309+
width: 100%;
310+
}
311+
303312
/* Desktop: Button auto-width when not full-width */
304-
@media (min-width: 768px) {
313+
@media (min-width: 768px) /* desktop */ {
305314
.buttonSection[data-full-width='false'] .button {
306315
width: auto;
307316
min-width: 120px;
308317
}
318+
319+
.buttonSection[data-full-width='false'] .buttonSkeletonWrapper {
320+
width: var(--button-skeleton-width, 140px);
321+
}
309322
}
310323

311324
/* Error State */
@@ -324,8 +337,13 @@
324337
}
325338

326339
@keyframes fadeInSkeleton {
327-
0%, 50% { opacity: 0; }
328-
100% { opacity: 1; }
340+
0%,
341+
50% {
342+
opacity: 0;
343+
}
344+
100% {
345+
opacity: 1;
346+
}
329347
}
330348

331349
/* Skeleton image containers with aspect-ratio to prevent layout shift */

packages/ui/src/components/Card/SummaryCard.module.css.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ declare const styles: {
1818
readonly metadataSeparator: string;
1919
readonly buttonSection: string;
2020
readonly button: string;
21+
readonly buttonSkeletonWrapper: string;
2122
readonly overflowIndicator: string;
2223
readonly loadingContainer: string;
2324
readonly skeletonImageContainer: string;

0 commit comments

Comments
 (0)