Gallery layout
The gallery uses a responsive grid that adapts to your screen size:- Mobile
- Tablet
- Desktop
- Wide displays
1 column layout on small screens
- Full-width images for easy viewing
- Vertical scrolling through your collection
components/Images.tsx
The gallery automatically adjusts its layout using Tailwind CSS responsive breakpoints, ensuring optimal viewing on any device.
Featured image
The most recent image (first in the gallery) receives special treatment:- Double size: Spans 2 columns and 2 rows on medium+ screens
- Prominent display: Makes your latest creation stand out
- Auto-refresh: Updates automatically when you generate new images
components/Images.tsx
Interactive image cards
Each image card includes interactive features for a better viewing experience:Hover effects
When you hover over an image:Prompt overlay
A white overlay fades in (80% opacity) displaying the prompt used to generate the image.
components/Images.tsx
The prompt text is extracted from the image filename, which follows the pattern:
prompt_timestamp.pngSmooth transitions
All gallery interactions use CSS transitions:- Scale: 300ms ease-in-out for smooth enlargement
- Opacity: 200ms transition for overlay fade
- Transform: GPU-accelerated for smooth performance
Refresh functionality
The gallery includes a floating refresh button for manual updates:Button location
- Fixed position at bottom-right of the screen
- Floats above all content (z-index: 20)
- Always accessible regardless of scroll position
components/Images.tsx
Button states
Idle state
Idle state
Displays “Refresh Images” in violet with 90% opacity background.
Refreshing state
Refreshing state
Shows “Refreshing…” while fetching updated image list from the server.
Hover state
Hover state
Background changes to solid violet on hover with smooth color transition.
Automatic updates
The gallery automatically refreshes when you generate new images:components/PromptInput.tsx
SWR’s mutate function triggers a revalidation of the gallery data, ensuring new images appear without manual refresh.
Loading states
The gallery provides clear feedback during data fetching:Initial load
When first loading the gallery:- Light font weight for subtle appearance
- Violet “AI” text for brand consistency
- Bottom padding to separate from images
Empty state
If no images exist yet, the grid simply remains empty. Users can generate their first image using the prompt input above.Image sorting
Images are automatically sorted by timestamp in descending order (newest first):azure/src/functions/getImages.js
- Your latest creations always appear first
- The featured image is always your most recent generation
- Chronological browsing from new to old
Image data structure
Each image in the gallery includes:components/Images.tsx
URL structure
Image URLs follow this pattern:SAS token security
SAS token security
SAS (Shared Access Signature) tokens provide time-limited, secure access to images in Azure Blob Storage without exposing account keys.
Image naming
Image naming
The filename format
prompt_timestamp.png allows extracting both the generation prompt and exact creation time from the filename alone.Performance optimization
The gallery is optimized for fast loading and smooth interactions:Image optimization
Next.js Image component provides:components/Images.tsx
unoptimized={true}: Images served directly from Azure Blob Storage- Consistent 500x500 dimensions for predictable layout
- Shadow and drop-shadow for visual depth
Images are set to unoptimized because they’re already optimized by DALL-E 3 at 1024x1024 and served through Azure’s CDN.
SWR caching
Gallery data is cached using SWR:components/Images.tsx
- Instant display of cached images on page load
- Background revalidation when manually triggered
- Optimistic UI updates during refresh
- Reduced API calls with
revalidateOnFocus: false
Responsive design features
The gallery adapts to different screen sizes:| Breakpoint | Columns | Padding | Featured |
|---|---|---|---|
| Mobile (< 768px) | 1 | None | 1x1 |
| Tablet (768px+) | 2 | 2.5rem | 2x2 |
| Desktop (1024px+) | 3 | 2.5rem | 2x2 |
| Wide (1280px+) | 4 | 2.5rem | 2x2 |
Accessibility
The gallery includes accessibility features:- Alt text: Each image uses its filename as alt text
- Keyboard navigation: All interactive elements are keyboard accessible
- Focus states: Visible focus rings on buttons
- Cursor hints:
cursor-helpindicates prompt overlay on hover
Next steps
Azure integration
Learn how images are stored and served through Azure
Image generation
Understand the image creation process