Skip to content

Commit 72c88c9

Browse files
committed
fix: prettier
1 parent dec1f0f commit 72c88c9

File tree

5 files changed

+15
-31
lines changed

5 files changed

+15
-31
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ Then, `/categories` displays a list of categories, with their cover image.
188188

189189
#### Other Taxonomies
190190

191-
You can also use other taxonomies like `series`. Note that only `categories` and `tags` are enabled by Hugo's default settings. Using `series` as additional taxonomy is left as an exercise for the reader.
191+
You can also use other taxonomies like `series`. Note that only `categories` and `tags` are enabled by Hugo's default settings. Using `series` as additional taxonomy is left as an exercise for the reader.
192192

193193
### Featured Content on the Homepage
194194

assets/css/_styles.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,8 @@ section.gallery {
270270
border-radius: 1rem;
271271
}
272272

273-
& > img, & figure > img {
273+
& > img,
274+
& figure > img {
274275
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
275276
border-radius: 1rem;
276277
aspect-ratio: 3/2;

assets/css/main.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@
1717

1818
img.lazyload:not([src]) {
1919
visibility: hidden;
20-
}
20+
}

assets/js/justified-layout.ts

Lines changed: 10 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,8 @@ class Row {
4141
this.rowHeight = params.rowHeight;
4242
this.heightTolerance = params.heightTolerance;
4343

44-
this.minAspectRatio =
45-
(this.rowWidth / params.rowHeight) * (1 - params.heightTolerance);
46-
this.maxAspectRatio =
47-
(this.rowWidth / params.rowHeight) * (1 + params.heightTolerance);
44+
this.minAspectRatio = (this.rowWidth / params.rowHeight) * (1 - params.heightTolerance);
45+
this.maxAspectRatio = (this.rowWidth / params.rowHeight) * (1 + params.heightTolerance);
4846
}
4947

5048
/**
@@ -71,8 +69,7 @@ class Row {
7169
const newItems = this.items.concat(itemData);
7270

7371
// Calculate aspect ratios for items only; exclude spacing
74-
const rowWidthWithoutSpacing =
75-
this.rowWidth - (newItems.length - 1) * this.spacing;
72+
const rowWidthWithoutSpacing = this.rowWidth - (newItems.length - 1) * this.spacing;
7673
const newAspectRatio = newItems.reduce(function (sum, item) {
7774
return sum + item.aspectRatio;
7875
}, 0);
@@ -96,22 +93,15 @@ class Row {
9693
}
9794

9895
// Calculate width/aspect ratio for row before adding new item
99-
const previousRowWidthWithoutSpacing =
100-
this.rowWidth - (this.items.length - 1) * this.spacing;
96+
const previousRowWidthWithoutSpacing = this.rowWidth - (this.items.length - 1) * this.spacing;
10197
const previousAspectRatio = this.items.reduce(function (sum, item) {
10298
return sum + item.aspectRatio;
10399
}, 0);
104-
const previousTargetAspectRatio =
105-
previousRowWidthWithoutSpacing / this.rowHeight;
100+
const previousTargetAspectRatio = previousRowWidthWithoutSpacing / this.rowHeight;
106101

107-
if (
108-
Math.abs(newAspectRatio - targetAspectRatio) >
109-
Math.abs(previousAspectRatio - previousTargetAspectRatio)
110-
) {
102+
if (Math.abs(newAspectRatio - targetAspectRatio) > Math.abs(previousAspectRatio - previousTargetAspectRatio)) {
111103
// Row with new item is us farther away from target than row without; complete layout and reject item.
112-
this.completeLayout(
113-
previousRowWidthWithoutSpacing / previousAspectRatio,
114-
);
104+
this.completeLayout(previousRowWidthWithoutSpacing / previousAspectRatio);
115105
return false;
116106
} else {
117107
// Row with new item is closer to target than row without;
@@ -133,25 +123,18 @@ class Row {
133123
* Set row height and compute item geometry from that height.
134124
*/
135125
completeLayout(newHeight: number) {
136-
const rowWidthWithoutSpacing =
137-
this.rowWidth - (this.items.length - 1) * this.spacing;
126+
const rowWidthWithoutSpacing = this.rowWidth - (this.items.length - 1) * this.spacing;
138127
let clampedToNativeRatio;
139128

140129
// Clamp row height to edge case minimum/maximum.
141-
const clampedHeight = Math.max(
142-
0.5 * this.rowHeight,
143-
Math.min(newHeight, 2 * this.rowHeight),
144-
);
130+
const clampedHeight = Math.max(0.5 * this.rowHeight, Math.min(newHeight, 2 * this.rowHeight));
145131

146132
if (newHeight !== clampedHeight) {
147133
// If row height was clamped, the resulting row/item aspect ratio will be off,
148134
// so force it to fit the width (recalculate aspectRatio to match clamped height).
149135
// NOTE: this will result in cropping/padding commensurate to the amount of clamping.
150136
this.height = clampedHeight;
151-
clampedToNativeRatio =
152-
rowWidthWithoutSpacing /
153-
clampedHeight /
154-
(rowWidthWithoutSpacing / newHeight);
137+
clampedToNativeRatio = rowWidthWithoutSpacing / clampedHeight / (rowWidthWithoutSpacing / newHeight);
155138
} else {
156139
// If not clamped, leave ratio at 1.0.
157140
this.height = newHeight;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"devDependencies": {
3-
"prettier": "^3.4.2",
3+
"prettier": "^3.5.0",
44
"prettier-plugin-css-order": "^2.1.2",
55
"prettier-plugin-go-template": "^0.0.15",
66
"prettier-plugin-organize-attributes": "^1.0.0",

0 commit comments

Comments
 (0)