Replace gallery S/M/L size buttons with a continuous thumbnail size slider#83
Open
Replace gallery S/M/L size buttons with a continuous thumbnail size slider#83
Conversation
…ze slider - Add `thumbnailSize` (default 220) to gallery state defaults - Change `viewMode` default to 'grid'; migrate legacy 'small'/'medium'/'large' values - Replace S/M/L buttons with a range slider (100-500px) in ImageGallery - Apply thumbnail size via inline gridTemplateColumns style in GalleryGridView - Compute imagesPerPage dynamically from thumbnailSize - Add CSS for slider control (.thumbnail-size-control, .thumbnail-size-slider, .thumbnail-size-label) - Update ImageGallery tests; add 7 new migration tests to galleryState.test.js Co-authored-by: travisdock <36681963+travisdock@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add customization options for image gallery grid view
Replace gallery S/M/L size buttons with a continuous thumbnail size slider
Mar 18, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the image gallery UI/state model to replace discrete S/M/L grid sizes with a continuous thumbnail-size slider, while keeping list-view as a separate mode and migrating legacy persisted state.
Changes:
- Adds
thumbnailSizeto persisted gallery state (default 220) and migrates legacyviewModevalues (small/medium/large) toviewMode='grid'+ mappedthumbnailSize. - Replaces S/M/L buttons with a range slider and updates pagination sizing based on
thumbnailSize. - Updates grid rendering to use CSS grid
auto-fillwith an inlinegridTemplateColumns, and updates/extends unit tests for the new state + migration behavior.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/src/utils/galleryState.js | Adds defaults + migration logic for thumbnailSize and legacy viewMode values. |
| frontend/src/utils/tests/galleryState.test.js | Adds migration test coverage for loadGalleryStateWithDefaults. |
| frontend/src/components/tests/ImageGallery.test.js | Updates persistence/restoration tests to use the slider + new state shape. |
| frontend/src/components/ImageGallery.js | Wires new slider UI, persists thumbnailSize, and updates imagesPerPage logic. |
| frontend/src/components/GalleryGridView.js | Applies thumbnailSize via inline CSS grid template columns. |
| frontend/src/App.css | Adds styling for the thumbnail size slider control in the header. |
Comment on lines
+58
to
60
| const imagesPerPage = viewMode === 'list' ? 200 : Math.max(12, Math.round(IMAGES_PER_PAGE_SCALE / thumbnailSize)); | ||
|
|
||
| const filteredImages = sortImages( |
| onImageLoadStatusChange, | ||
| }) { | ||
| const gridStyle = viewMode !== 'list' | ||
| ? { gridTemplateColumns: `repeat(auto-fill, minmax(${thumbnailSize}px, 1fr))` } |
Comment on lines
47
to
+60
| function loadGalleryStateWithDefaults(key) { | ||
| return { ...GALLERY_STATE_DEFAULTS, ...loadGalleryState(key) }; | ||
| const saved = loadGalleryState(key); | ||
| const merged = { ...GALLERY_STATE_DEFAULTS, ...saved }; | ||
|
|
||
| // Migrate old named viewMode values to 'grid' + thumbnailSize | ||
| const legacySizeMap = { small: 150, medium: 220, large: 300 }; | ||
| if (legacySizeMap[merged.viewMode] !== undefined) { | ||
| if (saved.thumbnailSize === undefined) { | ||
| merged.thumbnailSize = legacySizeMap[merged.viewMode]; | ||
| } | ||
| merged.viewMode = 'grid'; | ||
| } | ||
|
|
||
| return merged; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The image gallery only offered three fixed grid sizes (S/M/L). This adds a continuous slider (100–500px) that simultaneously controls thumbnail size and images-per-row via CSS grid's
auto-fill.State & persistence
thumbnailSizefield (default 220px) added to gallery state defaults and persisted in localStorage alongsideviewModeviewModesimplified to'grid' | 'list'; legacy'small'/'medium'/'large'values are migrated transparently vialoadGalleryStateWithDefaultsGrid rendering
GalleryGridViewnow acceptsthumbnailSizeand applies it as an inline style instead of CSS class switching:imagesPerPagescales inversely:Math.max(12, Math.round(15000 / thumbnailSize))UI
<input type="range" min=100 max=500 step=10>slider with a live pixel readoutTests
ImageGallerytests to use the slider and new state shapegalleryState.test.jscovering all legacy viewMode valuesOriginal prompt
💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.