-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCallToAction.js
More file actions
35 lines (31 loc) · 895 Bytes
/
CallToAction.js
File metadata and controls
35 lines (31 loc) · 895 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
const Image = require("@11ty/eleventy-img");
const image = async (src, alt) => {
let metadata = await Image(src, {
formats: ["avif", "webp", "jpeg"],
widths: [600, 1200, 2000, "auto"],
outputDir: "./_site/img/",
});
let imageAttributes = {
alt,
sizes:
"(max-width: 600px) 600px, (max-width: 1200px) 1200px, (max-width: 2000px) 2000px, 100vw",
loading: "lazy",
decoding: "async",
style: "height:100%;width:100%;object-fit:cover",
};
return Image.generateHTML(metadata, imageAttributes);
};
module.exports = async ({ title, body, imageSrc, imageAlt, link }) => {
return `
<div class="call-to-action">
<div class="call-to-action-overlay">
<div class="call-to-action-content boxed-regular">
<h2>${title}</h2>
<p>${body}</p>
${link}
</div>
</div>
</div>
</div>
`;
};