Skip to content

Commit 9f3d658

Browse files
Create 2 col video layout
1 parent 0765dd9 commit 9f3d658

File tree

7 files changed

+75
-63
lines changed

7 files changed

+75
-63
lines changed
20.6 KB
Loading
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
import ReleaseVideoPlaceholder from "../../assets/img/audacity-placeholder.webp";
3+
import PromoProductVideoPlaceholder from "../../assets/img/waves-denoiz-plugin.webp";
4+
import FeaturedVideo from "../video/FeaturedVideo";
5+
---
6+
7+
<section class="bg-gray-900">
8+
<div class="grid md:grid-cols-2 max-w-screen-2xl px-6 sm:px-12 mx-auto py-8 gap-8 ">
9+
<FeaturedVideo title="Our latest release" label="Master channel, new realtime effects & more!" placeholderImage={ReleaseVideoPlaceholder} videoURL="https://www.youtube-nocookie.com/embed/f5TXPUOFH6A?autoplay=1"/>
10+
<FeaturedVideo title="Waves Denoiz Plugin" label="A new generation of noise removal that outpeforms traditional plugins." placeholderImage={PromoProductVideoPlaceholder} videoURL="https://www.youtube-nocookie.com/embed/f5TXPUOFH6A?autoplay=1" CTA ctaText="Get 50% off"/>
11+
</div>
12+
</section>
13+
14+
15+

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 = "" } = 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">
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)