-
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
base: next
Are you sure you want to change the base?
Changes from all commits
b0a3f1a
74332ac
cca764d
ad2d0a2
6a19314
fdd55c4
e9cdc62
f865311
ca9305e
8e9c9b0
576c569
f40ea8b
970e4f2
f862f49
eb6d900
89e6886
613db2e
9dfc81c
32817bd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| export interface GalleryBreakpointColumns { | ||
| xs?: string | number; | ||
| sm?: string | number; | ||
| md?: string | number; | ||
| lg?: string | number; | ||
| xl?: string | number; | ||
| xxl?: string | number; | ||
| } | ||
|
|
||
| export type GalleryColumns = GalleryBreakpointColumns | string | number; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| @import "../../themes/native/native.globals"; | ||
|
|
||
| // Gallery | ||
| // -------------------------------------------------- | ||
|
|
||
| :host { | ||
| /** | ||
| * @prop --ion-gallery-gap: Space between gallery items | ||
| */ | ||
| display: grid; | ||
| grid-template-columns: repeat(var(--internal-gallery-columns, 2), minmax(0, 1fr)); | ||
| } | ||
|
|
||
| // Layout: Uniform | ||
| // -------------------------------------------------- | ||
|
|
||
| :host(.gallery-layout-uniform) { | ||
| gap: var(--ion-gallery-gap, 16px); | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Gap currently can only be changed by CSS. Should this be a property that can be updated based on breakpoint, like |
||
| } | ||
|
|
||
| // Target all slotted elements in the uniform layout. This ensures that nested | ||
| // images also have an aspect ratio of 1/1. | ||
| :host(.gallery-layout-uniform) ::slotted(*) { | ||
| aspect-ratio: 1/1; | ||
| } | ||
|
|
||
| // Layout: Masonry | ||
| // -------------------------------------------------- | ||
|
|
||
| :host(.gallery-layout-masonry) { | ||
| align-items: start; | ||
|
|
||
| column-gap: var(--ion-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(--ion-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 margin(0); | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is required to be here because if the user wraps the img in something with default margin (like |
||
|
|
||
| width: 100%; | ||
| } | ||
|
|
||
| ::slotted(img) { | ||
| display: block; | ||
|
|
||
| object-fit: cover; | ||
| object-position: center; | ||
| } | ||
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.