Skip to content

Commit 15cd9ba

Browse files
Merge pull request #52 from audacity/optimised-images
Tested on branch deploy
2 parents e8adf5f + 2c2e2fc commit 15cd9ba

12 files changed

+145
-297
lines changed

src/assets/img/Audacity_Logo.svg

+25-193
Loading

src/components/button/JoinAudioDotComButton.jsx

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import React from "react";
21
import { trackEvent } from "../../utils/matomo";
32

43
function handleButtonClick(eventName) {
@@ -8,11 +7,11 @@ function handleButtonClick(eventName) {
87
}
98

109
function JoinAudioDotComButton(props) {
11-
const { href, matomoEventName, large } = props;
10+
const { href, large } = props;
1211
return (
1312
<a
1413
onClick={() => {
15-
handleButtonClick(matomoEventName);
14+
handleButtonClick();
1615
}}
1716
className={` ${
1817
large ? "py-4 px-6" : "py-2 px-4"

src/components/card/NEWBlogPostCard.astro

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const options: Intl.DateTimeFormatOptions = {
2424
class="col-span-12 sm:col-span-6 md:col-span-4 flex flex-col gap-4 hover:opacity-90 transition-opacity duration-200"
2525
>
2626
<Image
27-
width="800"
27+
width="732"
2828
quality="80"
2929
class="rounded-md aspect-image"
3030
alt={coverAlt}
+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
---
2+
import { getImage } from "astro:assets";
3+
import audiocomBackground from "../../assets/img/audiocom-background.webp";
4+
import { Image } from "astro:assets";
5+
import FeaturedVideo from "../video/FeaturedVideo";
6+
import JoinAudioDotComButton from "../button/JoinAudioDotComButton";
7+
import AudioDotComLogo from "../../assets/img/audio-dot-com.svg";
8+
import VideoPlaceholder from '../../assets/img/audiocom-placeholder.webp'
9+
10+
// Optimize the background image
11+
const optimizedBg = await getImage({
12+
src: audiocomBackground,
13+
format: "webp",
14+
width: 960, // Default size, you can adjust based on your needs
15+
quality: 50,
16+
});
17+
18+
const releaseVideoPlaceholderImage = await getImage({
19+
src: VideoPlaceholder,
20+
format: "webp",
21+
width: 732,
22+
quality: 80,
23+
});
24+
25+
const releaseVideo = {
26+
title: "Introducing Audio.com",
27+
placeholderImage: releaseVideoPlaceholderImage.src,
28+
videoURL: "https://www.youtube-nocookie.com/embed/ZDnQgaCoppo?autoplay=1",
29+
imageAltText: "Video thumbnail: 15 reasons why you should use Audio.com"
30+
};
31+
---
32+
33+
<!-- Apply the background using inline style -->
34+
<section style={`background-image: url('${optimizedBg.src}'); background-size: cover;`}>
35+
<div
36+
class="grid md:grid-cols-2 max-w-screen-xl px-6 sm:px-12 py-12 gap-8 mx-auto"
37+
>
38+
<div class="flex lg:items-center col-span-2 md:col-span-1 md:col-start-1 row-start-2 md:row-start-1">
39+
<FeaturedVideo
40+
client:load
41+
placeholderImage={releaseVideo.placeholderImage}
42+
imageAltText={releaseVideo.imageAltText}
43+
videoURL={releaseVideo.videoURL}
44+
textColor="text-slate-50"
45+
matomoEventName={releaseVideo.title}
46+
/>
47+
</div>
48+
<div class="col-span-2 md:col-span-1 md:col-start-2 md:row-start-1 flex flex-col gap-8 lg:py-12">
49+
<Image src={AudioDotComLogo} class="w-20" alt="audio.com" />
50+
<div>
51+
<h2 class="text-white">Level up your Audacity</h2>
52+
<p class="text-gray-300 mt-4">
53+
Audio.com, the online companion to Audacity, lets you collaborate on
54+
projects, create versioned backups, and easily share and publish your
55+
work.
56+
</p>
57+
</div>
58+
59+
<JoinAudioDotComButton
60+
href="https://audio.com/audacity/auth/sign-in?mtm_campaign=audacityteamorg&mtm_content=Block_button"
61+
/>
62+
</div>
63+
</div>
64+
</section>

src/components/homepage/HeroBanner.astro

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@ import AudacityMockUp from "../../assets/img/HeroBannerImage.webp";
3333
<Image
3434
src={AudacityMockUp}
3535
alt="A laptop showing the Audacity application"
36-
width={960}
36+
width={668}
3737
quality={80}
38+
loading="eager"
3839
/>
3940
</div>
4041
</div>

0 commit comments

Comments
 (0)