Skip to content

Commit e87cd23

Browse files
committed
Fix thumbnail aspect ratio
1 parent 9dbe5e0 commit e87cd23

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

www/src/lib/components/gallery-thumbnail.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ let thumb
2323
class="flex w-full rounded-[1px] transition {FOCUS_OUTLINE}"
2424
type="button"
2525
class:opacity-50={isHidden}
26-
style:aspect-ratio={aspectRatio}
2726
on:click={onClick}
2827
>
2928
<ObserveIntersection once element={thumb} threshold={0.45} let:intersecting>
@@ -32,6 +31,7 @@ let thumb
3231
class:opacity-0={!intersecting}
3332
class:translate-y-6={!intersecting}
3433
class:delay-75={isDelayed}
34+
style:aspect-ratio={aspectRatio}
3535
bind:this={thumb}
3636
>
3737
<img

www/src/lib/components/masonry-grid.svelte

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ let masonryElement
2222
2323
export const refreshLayout = async () => {
2424
/* Get the post relayout number of columns */
25+
console.log('COLS', getComputedStyle(grid._el).gridTemplateColumns)
2526
let ncol = getComputedStyle(grid._el).gridTemplateColumns.split(' ').length
2627
let gap = Number.parseFloat(getComputedStyle(grid._el).gap)
2728
@@ -69,7 +70,7 @@ const calcGrid = async (element) => {
6970
_el: element,
7071
gap: Number.parseFloat(getComputedStyle(element).gap),
7172
// @ts-ignore
72-
items: [...element.children].filter(
73+
items: [...element.childNodes].filter(
7374
(c) =>
7475
c.nodeType === 1 &&
7576
Number(getComputedStyle(c).gridColumnEnd) !== -1,
@@ -105,19 +106,14 @@ $: if (items) {
105106
}
106107
</script>
107108
108-
<div
109-
bind:this={masonryElement}
110-
class="masonry-grid grid place-items-center {gapClass}"
111-
>
109+
<div bind:this={masonryElement} class="masonry-grid grid {gapClass}">
112110
<slot />
113111
</div>
114112
115113
<style>
116114
.masonry-grid {
117115
grid: 1fr auto / repeat(2, 1fr);
118116
grid: masonry / repeat(2, 1fr);
119-
}
120-
.masonry-grid > :global(*) {
121-
align-self: start;
117+
align-items: start;
122118
}
123119
</style>

0 commit comments

Comments
 (0)