Skip to content

Commit 4587ff6

Browse files
committed
Add AVIF conversion script and enhance landing page styles: introduce a new TypeScript file for converting images to AVIF format, update SCSS for the hero section with new layout and styles, and modify HTML structure to include organization details and a tagline.
1 parent 4b34f38 commit 4587ff6

6 files changed

Lines changed: 131 additions & 32 deletions

File tree

convert-single-to-avif.ts

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
import { access } from "node:fs/promises";
2+
import path from "node:path";
3+
import sharp from "sharp";
4+
5+
// Parse command line arguments
6+
const forceFlag = process.argv.includes("--force");
7+
const filePath = process.argv.find(
8+
arg =>
9+
!arg.startsWith("--") && arg !== process.argv[0] && arg !== process.argv[1],
10+
);
11+
12+
if (!filePath) {
13+
console.error("Usage: bun convert-single-to-avif.ts <file-path> [--force]");
14+
console.error("Example: bun convert-single-to-avif.ts image.jpg");
15+
console.error("Example: bun convert-single-to-avif.ts image.jpg --force");
16+
process.exit(1);
17+
}
18+
19+
async function convertToAvif(inputPath: string) {
20+
// Check if input file exists
21+
try {
22+
await access(inputPath);
23+
} catch {
24+
console.error(`Error: File '${inputPath}' does not exist.`);
25+
process.exit(1);
26+
}
27+
28+
const extension = path.extname(inputPath).toLowerCase();
29+
const supportedExtensions = [
30+
".jpg",
31+
".jpeg",
32+
".png",
33+
".webp",
34+
".bmp",
35+
".tiff",
36+
".tif",
37+
];
38+
39+
if (!supportedExtensions.includes(extension)) {
40+
console.error(
41+
`Error: Unsupported file format '${extension}'. Supported formats: ${supportedExtensions.join(", ")}`,
42+
);
43+
process.exit(1);
44+
}
45+
46+
const baseName = inputPath.replace(extension, "");
47+
const avifPath = `${baseName}.avif`;
48+
49+
// Check if AVIF file already exists
50+
try {
51+
await access(avifPath);
52+
if (!forceFlag) {
53+
console.log(
54+
`Skipped: ${avifPath} (already exists, use --force to overwrite)`,
55+
);
56+
return;
57+
}
58+
} catch {
59+
// File doesn't exist, will be created
60+
}
61+
62+
try {
63+
// Convert to AVIF without resizing or cropping
64+
await sharp(inputPath).avif({ quality: 50 }).toFile(avifPath);
65+
66+
console.log(`Converted: ${inputPath}${avifPath}`);
67+
} catch (error) {
68+
console.error(`Failed to convert ${inputPath}:`, error);
69+
process.exit(1);
70+
}
71+
}
72+
73+
// Convert the file
74+
await convertToAvif(filePath);
75+
console.log("Conversion complete.");

hugo/assets/scss/landing-page.scss

Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,56 @@
11
@use "components/nav-card";
2+
@use "button";
23

34
.hero {
45
position: relative;
5-
padding-block: var(--space-3xl) var(--space-3xl);
6+
padding: var(--space-m);
67
color: var(--brown-300);
8+
height: 100vh;
9+
10+
display: grid;
11+
grid-template-columns: auto;
12+
grid-template-rows: max-content 1fr max-content;
13+
14+
.button {
15+
align-self: start;
16+
}
17+
}
18+
19+
.tagline {
20+
font-size: var(--step-6);
21+
font-weight: var(--font-weight-boldest);
22+
line-height: 1.2;
23+
margin: 0;
24+
color: var(--brown-200);
25+
max-width: 18ch;
26+
text-wrap: pretty;
27+
margin-block-end: var(--space-2xl);
28+
}
29+
30+
.org-container {
31+
display: flex;
32+
flex-direction: column;
33+
color: var(--brown-200);
734
}
35+
36+
.org-name {
37+
font-weight: var(--font-weight-boldest);
38+
}
39+
40+
.org-location {
41+
font-size: var(--step--2);
42+
}
43+
844
.hero::before {
945
content: "";
1046
position: absolute;
1147
top: 0;
1248
left: 0;
1349
right: 0;
1450
bottom: 0;
15-
background-image: url("/assets/images/hero-background.png");
51+
background-image: url("/assets/images/hero-section.avif");
1652
background-size: cover;
17-
background-position: center;
53+
background-position: calc(50% + 23rem) center;
1854
z-index: -2;
1955
}
2056
.hero::after {
@@ -31,9 +67,6 @@
3167
);
3268
z-index: -1;
3369
}
34-
.hero__content {
35-
max-width: 50%;
36-
}
3770

3871
.welcome {
3972
max-width: 60ch;
@@ -61,6 +94,10 @@
6194
max-width: 100%;
6295
}
6396

97+
.hero__content h1 {
98+
font-size: var(--step-3);
99+
}
100+
64101
.cta-cards__grid {
65102
grid-template-columns: 1fr; /* Stack cards on smaller screens */
66103
}

hugo/hugo_stats.json

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@
3535
"svg",
3636
"textarea",
3737
"title",
38-
"ul"
38+
"ul",
39+
"wrap"
3940
],
4041
"classes": [
41-
"2",
4242
"active",
4343
"amount",
4444
"benefits",
@@ -50,13 +50,11 @@
5050
"board-member-card__role",
5151
"board-members",
5252
"browse-buttons",
53-
"browse-section",
5453
"button",
5554
"callout",
5655
"callout__icon",
5756
"callout__text",
5857
"contact-info",
59-
"contact-section",
6058
"contact-us-page__title",
6159
"container",
6260
"content-wrapper",
@@ -65,9 +63,7 @@
6563
"currency-symbol",
6664
"date-grid",
6765
"doula-list",
68-
"f",
6966
"faq",
70-
"fieldset-group",
7167
"find-a-doula-nav",
7268
"footer",
7369
"footer-icon",
@@ -89,22 +85,17 @@
8985
"form",
9086
"form-group",
9187
"form__confirmation",
92-
"form__date-fields",
9388
"form__error-message",
9489
"form__group",
95-
"form__group--checkbox",
96-
"form__group--radio",
97-
"form__grouphalf-width",
9890
"form__input",
9991
"form__input--textarea",
10092
"form__label",
10193
"full-width",
102-
"fw",
103-
"half-width",
10494
"header",
10595
"headshot",
10696
"headshot__image",
10797
"hero",
98+
"hero__content",
10899
"highlight",
109100
"info-content",
110101
"input-grid",
@@ -113,7 +104,6 @@
113104
"main",
114105
"membership-cta",
115106
"membership-join",
116-
"na",
117107
"name",
118108
"nav-card",
119109
"nav-card__description",
@@ -125,29 +115,22 @@
125115
"navbar__link",
126116
"navbar__logo",
127117
"navbar__nav",
128-
"post-submission-section",
118+
"org-container",
119+
"org-location",
120+
"org-name",
129121
"price",
130122
"profile-card",
131123
"profile-card-container",
132124
"profile-container",
133125
"search-form",
134-
"search-section",
135126
"single-column",
136127
"small",
137-
"standalone-form",
138128
"tag",
139129
"tag-group",
130+
"tagline",
140131
"tags",
141-
"test",
142-
"test-input",
143-
"test-input2",
144-
"test-label",
145-
"test-label2",
146132
"text-content",
147-
"title",
148-
"two-colum",
149-
"two-column",
150-
"|"
133+
"title"
151134
],
152135
"ids": [
153136
"birth-doula",

hugo/layouts/index.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,12 @@
77

88
{{ define "hero" }}
99
<section class="hero">
10-
<h1>Doulas for every step of your birth journey</h1>
10+
<div class="tagline">Doulas for every step of your birth journey</div>
1111
<a href="/find-a-doula/" class="button">Find a Doula</a>
12+
<div class="org-container">
13+
<span class="org-name">Doula Cooperative</span>
14+
<span class="org-location">Rochester, NY</span>
15+
</div>
1216
</section>
1317
{{ end }}
1418

13.9 KB
Binary file not shown.
52.3 KB
Binary file not shown.

0 commit comments

Comments
 (0)