Skip to content

Commit 543a778

Browse files
committed
replace demo.gif with video support in Hero component
1 parent 3a397a1 commit 543a778

File tree

4 files changed

+31
-7
lines changed

4 files changed

+31
-7
lines changed

public/demo.gif

-3.65 MB
Binary file not shown.

public/demo.mp4

465 KB
Binary file not shown.

public/demo.webm

929 KB
Binary file not shown.

src/components/Hero.astro

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
---
2-
import { Image } from 'astro:assets'
3-
42
/**
53
* Hero Component
64
*
75
* @description A component that displays a hero section with a title, description, and image
86
*/
97
interface Props {
108
/**
11-
* The source URL for the image
9+
* Source for the WebM video
10+
*/
11+
srcWebm?: string
12+
/**
13+
* Source for the MP4 video
1214
*/
13-
src?: string
15+
srcMp4?: string
1416
}
1517
16-
const { src = '/demo.gif' }: Props = Astro.props
18+
const { srcWebm = '/demo.webm', srcMp4 = '/demo.mp4' }: Props = Astro.props
1719
---
1820

1921
<section class="hero my-24">
@@ -31,9 +33,31 @@ const { src = '/demo.gif' }: Props = Astro.props
3133
<img src="/google-play-badge.png" alt="Get it on Google Play" width="200" class="h-auto" />
3234
</a>
3335
</div>
34-
<Image class="block w-full max-w-xs mt-8 lg:hidden" src={src} alt="" decoding="async" width={400} height={300} loading="eager" />
36+
<video
37+
class="block w-full max-w-xs mt-8 lg:hidden"
38+
autoplay
39+
muted
40+
loop
41+
playsinline
42+
width="400"
43+
height="300"
44+
>
45+
<source src={srcWebm} type="video/webm" />
46+
<source src={srcMp4} type="video/mp4" />
47+
</video>
3548
</div>
36-
<Image class="hidden lg:block" src={src} alt="" decoding="async" width={800} height={600} loading="eager" />
49+
<video
50+
class="hidden lg:block"
51+
autoplay
52+
muted
53+
loop
54+
playsinline
55+
width="536"
56+
height="687"
57+
>
58+
<source src={srcWebm} type="video/webm" />
59+
<source src={srcMp4} type="video/mp4" />
60+
</video>
3761
</div>
3862
</div>
3963
</section>

0 commit comments

Comments
 (0)