diff options
Diffstat (limited to 'subprojects/docs/src/components/Video/index.tsx')
-rw-r--r-- | subprojects/docs/src/components/Video/index.tsx | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/subprojects/docs/src/components/Video/index.tsx b/subprojects/docs/src/components/Video/index.tsx new file mode 100644 index 00000000..bd36eaa4 --- /dev/null +++ b/subprojects/docs/src/components/Video/index.tsx | |||
@@ -0,0 +1,62 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2024 The Refinery Authors | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
6 | |||
7 | import { useState } from 'react'; | ||
8 | |||
9 | import coverBackground from './cover-background.png?sizes[]=1920&sizes[]=1288&sizes[]=1108&&sizes[]=644&sizes[]=322&placeholder=true&rl'; | ||
10 | import Cover from './cover.svg'; | ||
11 | import styles from './index.module.css'; | ||
12 | |||
13 | export default function Video() { | ||
14 | const [started, setStarted] = useState(false); | ||
15 | return ( | ||
16 | <> | ||
17 | <h2 className="sr-only">Check out the intro video</h2> | ||
18 | <div className="container"> | ||
19 | <div className={styles['video__container']}> | ||
20 | {started ? ( | ||
21 | <iframe | ||
22 | width="560" | ||
23 | height="315" | ||
24 | src="https://www.youtube-nocookie.com/embed/Qy_3udNsWsM?autoplay=1" | ||
25 | title="YouTube video player" | ||
26 | frameBorder="0" | ||
27 | allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" | ||
28 | referrerPolicy="strict-origin-when-cross-origin" | ||
29 | allowFullScreen | ||
30 | className={styles['video']} | ||
31 | /> | ||
32 | ) : ( | ||
33 | <button | ||
34 | type="button" | ||
35 | aria-label="Video introduction" | ||
36 | title="Play video (requires acceping cookies from YouTube)" | ||
37 | onClick={() => setStarted(true)} | ||
38 | className={styles['video__button']} | ||
39 | style={{ | ||
40 | backgroundImage: `url("${coverBackground.placeholder}")`, | ||
41 | }} | ||
42 | > | ||
43 | <img | ||
44 | alt="" | ||
45 | src={coverBackground.src} | ||
46 | srcSet={coverBackground.srcSet} | ||
47 | width={coverBackground.width} | ||
48 | height={coverBackground.height} | ||
49 | sizes="(min-width: 1440px) 1288px, (min-width: 1140px) 1108px, calc(100vw - 32px)" | ||
50 | loading="lazy" | ||
51 | className={styles['video__image']} | ||
52 | /> | ||
53 | <div className={styles['video__svg']}> | ||
54 | <Cover /> | ||
55 | </div> | ||
56 | </button> | ||
57 | )} | ||
58 | </div> | ||
59 | </div> | ||
60 | </> | ||
61 | ); | ||
62 | } | ||