diff options
author | 2024-04-18 18:40:31 +0200 | |
---|---|---|
committer | 2024-04-18 19:59:51 +0200 | |
commit | 419fcdbfd0aed6892ee4fb1fdb0d50eea55dead8 (patch) | |
tree | 08a888611ca944597e300fab9f6a9c5de676255c /subprojects/docs/src/components | |
parent | docs: update landing page (diff) | |
download | refinery-419fcdbfd0aed6892ee4fb1fdb0d50eea55dead8.tar.gz refinery-419fcdbfd0aed6892ee4fb1fdb0d50eea55dead8.tar.zst refinery-419fcdbfd0aed6892ee4fb1fdb0d50eea55dead8.zip |
refactor(docs): update video cover
Also adds responsive-loader support for images.
Diffstat (limited to 'subprojects/docs/src/components')
-rw-r--r-- | subprojects/docs/src/components/Video/cover-background.png | bin | 0 -> 1979050 bytes | |||
-rw-r--r-- | subprojects/docs/src/components/Video/cover-background.png.license | 9 | ||||
-rw-r--r-- | subprojects/docs/src/components/Video/cover.svg | 1 | ||||
-rw-r--r-- | subprojects/docs/src/components/Video/cover.svg.license | 3 | ||||
-rw-r--r-- | subprojects/docs/src/components/Video/index.module.css | 75 | ||||
-rw-r--r-- | subprojects/docs/src/components/Video/index.tsx | 62 |
6 files changed, 150 insertions, 0 deletions
diff --git a/subprojects/docs/src/components/Video/cover-background.png b/subprojects/docs/src/components/Video/cover-background.png new file mode 100644 index 00000000..11369ae3 --- /dev/null +++ b/subprojects/docs/src/components/Video/cover-background.png | |||
Binary files differ | |||
diff --git a/subprojects/docs/src/components/Video/cover-background.png.license b/subprojects/docs/src/components/Video/cover-background.png.license new file mode 100644 index 00000000..50ad65f2 --- /dev/null +++ b/subprojects/docs/src/components/Video/cover-background.png.license | |||
@@ -0,0 +1,9 @@ | |||
1 | SPDX-FileCopyrightText: 2024 The Refinery Authors <https://refinery.tools/> | ||
2 | |||
3 | SPDX-License-Identifier: EPL-2.0 | ||
4 | |||
5 | Modified image based on "Low Angle Shot of Manufacturing Plant under Blue Sky" | ||
6 | available under the CC-1.0 license at | ||
7 | https://www.pexels.com/photo/low-angle-shot-of-manufacturing-plant-under-blue-sky-257700/ | ||
8 | Original image "Bulgaria, Vratsa, Abandoned image. Free for use." by "2427999" also available at | ||
9 | https://pixabay.com/photos/bulgaria-vratsa-abandoned-industry-1351947/ | ||
diff --git a/subprojects/docs/src/components/Video/cover.svg b/subprojects/docs/src/components/Video/cover.svg new file mode 100644 index 00000000..b263c8b3 --- /dev/null +++ b/subprojects/docs/src/components/Video/cover.svg | |||
@@ -0,0 +1 @@ | |||
<svg xmlns="http://www.w3.org/2000/svg" width="1280" height="720" viewBox="0 0 1280 720"><path fill="#fff" fill-opacity=".4" d="M0 95h1280v530H0z"/><path class="videocolor" fill-opacity=".702" d="M0 171h1205v378H0z"/><path fill="#CA1243" d="M1261 95h19v530h-19z"/><path class="videocolor" d="M0 171h19v378H0z"/><g class="videotitle"><path fill-rule="evenodd" d="M1143 387.09v26.293c-69.4 3.985-192.57 26.695-256 95.615v-31.074c64.343-63.744 180.16-88.046 256-90.834M887 211c55.152 64.14 162.7 91.63 256 98.004V335.3c-93.3 6.374-200.85 33.866-256 98.003v-30.676c22.983-34.262 96.979-66.532 153.51-80.476-56.535-13.944-130.53-46.214-153.51-80.475z"/><text font-size="72" font-weight="800" transform="translate(31 439)">Video</text><text font-size="72" font-weight="800" transform="translate(31 525)">introduction</text></g><path class="videoplay" fill-rule="evenodd" d="M593.12 284.23v151.53l131.07-75.765zm46.879-85.227c88.918 0 161 72.082 161 161s-72.082 161-161 161-161-72.082-161-161 72.082-161 161-161"/></svg> | |||
diff --git a/subprojects/docs/src/components/Video/cover.svg.license b/subprojects/docs/src/components/Video/cover.svg.license new file mode 100644 index 00000000..b80566a0 --- /dev/null +++ b/subprojects/docs/src/components/Video/cover.svg.license | |||
@@ -0,0 +1,3 @@ | |||
1 | SPDX-FileCopyrightText: 2024 The Refinery Authors <https://refinery.tools/> | ||
2 | |||
3 | SPDX-License-Identifier: EPL-2.0 | ||
diff --git a/subprojects/docs/src/components/Video/index.module.css b/subprojects/docs/src/components/Video/index.module.css new file mode 100644 index 00000000..209c5d64 --- /dev/null +++ b/subprojects/docs/src/components/Video/index.module.css | |||
@@ -0,0 +1,75 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2024 The Refinery Authors | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
6 | |||
7 | :global(.videocolor) { | ||
8 | fill: var(--ifm-color-primary); | ||
9 | } | ||
10 | |||
11 | [data-theme='dark'] :global(.videocolor) { | ||
12 | fill: var(--ifm-color-primary-darker); | ||
13 | } | ||
14 | |||
15 | .video__container { | ||
16 | position: relative; | ||
17 | width: 100%; | ||
18 | height: auto; | ||
19 | aspect-ratio: 560/315; | ||
20 | box-shadow: var(--ifm-global-shadow-lw); | ||
21 | transition: box-shadow var(--ifm-button-transition-duration) var(--ifm-transition-timing-default); | ||
22 | } | ||
23 | |||
24 | .video__container:hover, | ||
25 | .video__container:focus-within { | ||
26 | box-shadow: var(--ifm-global-shadow-md); | ||
27 | } | ||
28 | |||
29 | .video, | ||
30 | .video__button, | ||
31 | .video__image, | ||
32 | .video__svg, | ||
33 | .video__svg > svg { | ||
34 | position: absolute; | ||
35 | top: 0; | ||
36 | left: 0; | ||
37 | width: 100%; | ||
38 | height: 100%; | ||
39 | } | ||
40 | |||
41 | .video__svg text { | ||
42 | font-family: var(--ifm-font-family-base); | ||
43 | } | ||
44 | |||
45 | .video__button { | ||
46 | margin: 0; | ||
47 | padding: 0; | ||
48 | border: none; | ||
49 | cursor: pointer; | ||
50 | background-size: cover; | ||
51 | } | ||
52 | |||
53 | .video__cover { | ||
54 | z-index: 1; | ||
55 | } | ||
56 | |||
57 | :global(.videoplay) { | ||
58 | fill: rgb(255 255 255 / 40%); | ||
59 | transition: fill var(--ifm-button-transition-duration) var(--ifm-transition-timing-default); | ||
60 | } | ||
61 | |||
62 | .video__container:hover :global(.videoplay), | ||
63 | .video__container:focus-within :global(.videoplay) { | ||
64 | fill: rgb(255 255 255 / 70%); | ||
65 | } | ||
66 | |||
67 | :global(.videotitle) * { | ||
68 | fill: #303846; | ||
69 | transition: fill var(--ifm-button-transition-duration) var(--ifm-transition-timing-default); | ||
70 | } | ||
71 | |||
72 | .video__container:hover :global(.videotitle) *, | ||
73 | .video__container:focus-within :global(.videotitle) * { | ||
74 | fill: #21252b; | ||
75 | } | ||
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 | } | ||