-
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
4009a8a
63aa6df
69938a8
5366cdc
2561ebc
f166cd3
5f10f44
4a333f3
30a04ab
924102e
38f7f4d
ca9d61d
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 @@ | ||
| import type { GalleryBreakpointColumns } from './gallery-interface'; | ||
|
|
||
| export const DEFAULT_COLUMNS: GalleryBreakpointColumns = { | ||
| xs: 2, | ||
| sm: 3, | ||
| md: 4, | ||
| lg: 6, | ||
| xl: 8, | ||
| xxl: 10, | ||
| }; |
| 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,65 @@ | ||
| @use "../../themes/native/native.globals" as 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
Contributor
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. Yes, I lean towards it especially seeing that Chakra does that. I do wonder if we should split it into |
||
| } | ||
|
|
||
| // 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(--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 globals.margin(0); | ||
|
|
||
| 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.