Skip to content

Commit c2f790b

Browse files
Merge pull request #39 from audacity/additional-video-slot
Additional video slot
2 parents 0765dd9 + dba9920 commit c2f790b

File tree

8 files changed

+106
-63
lines changed

8 files changed

+106
-63
lines changed
23 KB
Loading
20.6 KB
Loading
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
import ReleaseVideoPlaceholder from "../../assets/img/audacity-placeholder.webp";
3+
import MbcpolyspectralPlaceholder from "../../assets/img/mbc_polyspectral-placeholder.webp";
4+
import FeaturedVideo from "../video/FeaturedVideo";
5+
6+
const releaseVideo = {
7+
title:"Our latest release",
8+
label:"Master channel, new realtime effects & more!",
9+
placeholderImage: ReleaseVideoPlaceholder,
10+
videoURL:"https://www.youtube-nocookie.com/embed/f5TXPUOFH6A?autoplay=1"
11+
}
12+
13+
const promoVideo = {
14+
title:"Multiband Compressor",
15+
label:"Low-latency, transparent multiband compressor for real-time tracking and live mixing.",
16+
placeholderImage: MbcpolyspectralPlaceholder,
17+
videoURL:"https://www.youtube-nocookie.com/embed/Lb7jx4wdXXE?autoplay=1",
18+
CTA: true,
19+
ctaText: "Get 80% off",
20+
ctaURL:"https://www.musehub.com/plugin/polyspectral-mbc?utm_source=au-web&utm_medium=mh-cta&utm_campaign=polyspectral"
21+
}
22+
---
23+
24+
<section class="bg-gray-900">
25+
<div
26+
class="grid md:grid-cols-2 max-w-screen-2xl px-6 sm:px-12 mx-auto py-8 gap-8"
27+
>
28+
<FeaturedVideo
29+
client:load
30+
title={releaseVideo.title}
31+
label={releaseVideo.label}
32+
placeholderImage={releaseVideo.placeholderImage}
33+
videoURL={releaseVideo.videoURL}
34+
/>
35+
<FeaturedVideo
36+
client:load
37+
title={promoVideo.title}
38+
label={promoVideo.label}
39+
placeholderImage={promoVideo.placeholderImage}
40+
videoURL={promoVideo.videoURL}
41+
CTA={promoVideo.CTA}
42+
ctaText={promoVideo.ctaText}
43+
ctaURL={promoVideo.ctaURL}
44+
/>
45+
</div>
46+
</section>

src/components/homepage/ReleaseVideo.jsx

Lines changed: 0 additions & 59 deletions
This file was deleted.
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import React, { useState } from "react";
2+
3+
function FeaturedVideo(props) {
4+
const [isClicked, setIsClicked] = useState(false);
5+
6+
const { placeholderImage, videoURL, label, title, CTA, ctaText, ctaURL = "" } = props;
7+
8+
function handleVideoClick() {
9+
setIsClicked(true);
10+
if (typeof _paq !== "undefined") {
11+
_paq.push([
12+
"trackEvent",
13+
"Video embed",
14+
"Watch release video",
15+
"Audacity release video",
16+
]);
17+
}
18+
}
19+
20+
return (
21+
<div className="flex flex-col gap-2 lg:gap-4 ">
22+
<div className="flex flex-col xs:flex-row xs:justify-between md:h-10">
23+
<h3 className="text-white content-center">{title}</h3>
24+
{CTA && (
25+
<a className="py-3 px-2 rounded-md justify-center bg-yellow-300 hover:bg-yellow-400 active:bg-yellow-500 w-fit" href={ctaURL}>
26+
<p className="leading-none font-semibold">{ctaText}</p>
27+
</a>
28+
)}
29+
</div>
30+
31+
{isClicked ? (
32+
<iframe
33+
className="w-full aspect-video rounded-md shadow-xl"
34+
loading="lazy"
35+
src={videoURL}
36+
title="Audacity 3.2 - Real-Time Effects and Free Cloud Sharing"
37+
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
38+
allowFullScreen
39+
></iframe>
40+
) : (
41+
<img
42+
tabIndex="0"
43+
src={placeholderImage.src}
44+
alt="YouTube thumbnail"
45+
className="w-full aspect-video rounded-md shadow-xl cursor-pointer"
46+
onClick={() => handleVideoClick()}
47+
onKeyDown={(e) => e.key === "Enter" && handleVideoClick()}
48+
/>
49+
)}
50+
<p className="text-white">{label}</p>
51+
</div>
52+
);
53+
}
54+
55+
export default FeaturedVideo;

src/pages/index.astro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
import BlogPosts from "../components/homepage/BlogPosts.astro";
33
import HeroBanner from "../components/homepage/HeroBanner.astro";
4-
import ReleaseVideo from "../components/homepage/ReleaseVideo";
4+
import ReleaseVideo from "../components/homepage/ReleaseVideo.astro";
55
import BaseLayout from "../layouts/BaseLayout.astro";
66
import ShareYourSounds from "../components/homepage/ShareYourSounds";
77
import FeatureCards from "../components/homepage/FeatureCards.astro";
@@ -12,7 +12,7 @@ import RecordAnything from "../components/homepage/RecordAnything.astro";
1212

1313
<BaseLayout title="Audacity ® | Free Audio editor, recorder, music making and more!">
1414
<HeroBanner />
15-
<ReleaseVideo client:load/>
15+
<ReleaseVideo />
1616
<RecordAnything />
1717
<ShareYourSounds client:load/>
1818
<FeatureCards />

src/styles/input.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414

1515
h3 {
16-
@apply text-lg md:text-2xl text-gray-700 font-semibold
16+
@apply text-lg md:text-lg lg:text-2xl text-gray-700 font-semibold
1717
}
1818

1919
h4 {

tailwind.config.cjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ module.exports = {
44
theme: {
55
extend: {},
66
screens: {
7-
xs: "320px",
7+
xxs: "320px",
8+
xs: "480px",
89
sm: "640px",
910
md: "768px",
1011
lg: "1024px",

0 commit comments

Comments
 (0)