-
Notifications
You must be signed in to change notification settings - Fork 13.4k
feat(gallery): add new gallery component #31101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
brandyscarney
wants to merge
32
commits into
next
Choose a base branch
from
FW-7280
base: next
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
b0a3f1a
feat(gallery): add new gallery component
brandyscarney 74332ac
style(core): add TODOs for migrating global breakpoints
brandyscarney cca764d
test(gallery): add spec test for columns property
brandyscarney ad2d0a2
refactor(gallery): convert columns css variable to an internal variable
brandyscarney 6a19314
test(gallery): add basic e2e test
brandyscarney fdd55c4
chore(): add updated snapshots
brandyscarney e9cdc62
test(gallery): add layout e2e test
brandyscarney f865311
chore(): add updated snapshots
brandyscarney ca9305e
refactor(gallery): move types to separate file
brandyscarney 8e9c9b0
test(gallery): add spec tests for layout and order
brandyscarney 576c569
style: lint
brandyscarney f40ea8b
chore: pass non-snapshot images to Vercel
brandyscarney 970e4f2
Merge branch 'next' into FW-7280
brandyscarney f862f49
fix(gallery): reset margin on slotted elements to properly position them
brandyscarney eb6d900
test(gallery): add tests for dynamically appended images and fix the …
brandyscarney 89e6886
chore(): add updated snapshots
brandyscarney 613db2e
Merge branch 'next' into FW-7280
brandyscarney 9dfc81c
fix(gallery): remove the bottom margin from the last masonry item in …
brandyscarney 32817bd
chore(): add updated snapshots
brandyscarney 4009a8a
test(gallery): import default columns directly from gallery
brandyscarney 63aa6df
style: fix nested describes in test
brandyscarney 69938a8
style(gallery): update comment for sanitizeColumns
brandyscarney 5366cdc
refactor(gallery): return early when columns is undefined instead of …
brandyscarney 2561ebc
test(gallery): improve spec test organization and add more function t…
brandyscarney f166cd3
test(gallery): remove no longer used attribute
brandyscarney 5f10f44
refactor(gallery): migrate Sass from import to use
brandyscarney 4a333f3
test(gallery): dynamically added images wrapped in figures need to in…
brandyscarney 30a04ab
test(gallery): resize viewport to include the height of the gallery
brandyscarney 924102e
chore(): add updated snapshots
brandyscarney 38f7f4d
Merge branch 'next' into FW-7280
brandyscarney ca9d61d
chore(): add updated snapshots
brandyscarney d494fab
feat(gallery): add gap as a property with responsive breakpoints
brandyscarney File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| core/src/components/**/*/*.png | ||
| # Exclude visual-regression snapshot artifacts only | ||
| core/src/**/*-snapshots/*.png |
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import type { GalleryColumns, GalleryGap } from './gallery-interface'; | ||
|
|
||
| export const DEFAULT_COLUMNS = { | ||
| xs: 2, | ||
| sm: 3, | ||
| md: 4, | ||
| lg: 6, | ||
| xl: 8, | ||
| xxl: 10, | ||
| } satisfies GalleryColumns; | ||
|
|
||
| export const DEFAULT_GAP = '16px' satisfies GalleryGap; |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| export interface GalleryBreakpoints<T = string | number> { | ||
| xs?: T; | ||
| sm?: T; | ||
| md?: T; | ||
| lg?: T; | ||
| xl?: T; | ||
| xxl?: T; | ||
| } | ||
|
|
||
| export type GalleryColumns = GalleryBreakpoints | string | number; | ||
| export type GalleryGap = GalleryBreakpoints | string | number; |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| @use "../../themes/native/native.globals" as globals; | ||
|
|
||
| // Gallery | ||
| // -------------------------------------------------- | ||
|
|
||
| :host { | ||
| display: grid; | ||
| grid-template-columns: repeat(var(--internal-gallery-columns, 2), minmax(0, 1fr)); | ||
| } | ||
|
|
||
| // Layout: Uniform | ||
| // -------------------------------------------------- | ||
|
|
||
| :host(.gallery-layout-uniform) { | ||
| gap: var(--internal-gallery-gap, 16px); | ||
| } | ||
|
|
||
| // Target all slotted elements in the uniform layout. This ensures that divs | ||
| // and images have an aspect ratio of 1/1. Nested images must inherit the | ||
| // aspect ratio of their parent. | ||
| :host(.gallery-layout-uniform) ::slotted(*) { | ||
| aspect-ratio: 1/1; | ||
| } | ||
|
|
||
| // Layout: Masonry | ||
| // -------------------------------------------------- | ||
|
|
||
| :host(.gallery-layout-masonry) { | ||
| align-items: start; | ||
|
|
||
| column-gap: var(--internal-gallery-gap, 16px); | ||
| row-gap: 0; | ||
|
|
||
| grid-auto-rows: 2px; | ||
| } | ||
|
|
||
| :host(.gallery-layout-masonry) ::slotted(*) { | ||
| display: block; | ||
|
|
||
| // Clear min-height so items size to their content | ||
| min-height: unset; | ||
|
|
||
| margin-bottom: var(--internal-gallery-gap, 16px); | ||
| } | ||
|
|
||
| // Slotted elements | ||
| // -------------------------------------------------- | ||
|
|
||
| // Reset the default margin for slotted elements so wrapper elements | ||
| // (such as <figure>) align properly with other gallery items. | ||
| ::slotted(*) { | ||
| @include globals.margin(0); | ||
|
|
||
| width: 100%; | ||
| } | ||
|
|
||
| ::slotted(img) { | ||
| display: block; | ||
|
|
||
| object-fit: cover; | ||
| object-position: center; | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated this because this rule prevented the images in my
assets/directory from being served on Vercel.