Skip to content

Commit 20c4933

Browse files
authored
Merge pull request #2599 from redsh4de/feat/themeable-image
what-is-monero: use ThemeableImage component, artwork [beta]
2 parents ca06fc7 + e0679c6 commit 20c4933

6 files changed

Lines changed: 107 additions & 7 deletions

File tree

78.7 KB
Binary file not shown.
86.1 KB
Binary file not shown.
22.3 KB
Binary file not shown.
24.4 KB
Binary file not shown.
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
---
2+
import { Image } from "astro:assets";
3+
import type { ImageMetadata } from "astro";
4+
5+
interface Props {
6+
src: ImageMetadata;
7+
darkSrc?: ImageMetadata;
8+
alt: string;
9+
rtl?: boolean;
10+
class?: string;
11+
}
12+
13+
const {
14+
src,
15+
darkSrc,
16+
alt,
17+
rtl,
18+
class: className,
19+
...rest
20+
} = Astro.props as Props;
21+
---
22+
23+
<Image
24+
class:list={[className, darkSrc && "light-only"]}
25+
src={src}
26+
alt={alt}
27+
data-rtl={rtl || undefined}
28+
{...rest}
29+
/>
30+
{
31+
darkSrc && (
32+
<Image
33+
class:list={[className, "dark-only"]}
34+
src={darkSrc}
35+
alt={alt}
36+
data-rtl={rtl || undefined}
37+
{...rest}
38+
/>
39+
)
40+
}
41+
42+
<style>
43+
[data-rtl] {
44+
transform: scaleX(-1);
45+
transform-origin: center;
46+
}
47+
48+
.dark-only {
49+
display: none;
50+
}
51+
52+
@media (prefers-color-scheme: dark) {
53+
.light-only {
54+
display: none;
55+
}
56+
57+
.dark-only {
58+
display: block;
59+
}
60+
}
61+
</style>

src/pages/get-started/what-is-monero.astro

Lines changed: 46 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
import Layout from "@/layouts/Layout.astro";
33
44
import FeatureCard from "@/components/pages/get-started/what-is-monero/FeatureCard.astro";
5+
56
import UseCaseItem from "@/components/pages/get-started/what-is-monero/UseCaseItem.astro";
7+
import ThemeableImage from "@/components/ui/ThemeableImage.astro";
68
import { Image } from "astro:assets";
79
810
import Row from "@/components/ui/layout/Row.astro";
@@ -15,8 +17,11 @@ import TitleCard from "@/components/ui/TitleCard.astro";
1517
import VideoContainer from "@/components/ui/VideoContainer.astro";
1618
1719
import communityLogo from "@/assets/images/community-logo.avif";
18-
import cryptoLock from "@/assets/images/crypto-lock.avif";
19-
import surveillanceImage from "@/assets/images/surveillanceImage.avif";
20+
21+
import surveillanceImage from "@/assets/images/what-is-monero/surveillance-light.avif";
22+
import surveillanceImageDark from "@/assets/images/what-is-monero/surveillance-dark.avif";
23+
import privacyImage from "@/assets/images/what-is-monero/privacy-light.avif";
24+
import privacyImageDark from "@/assets/images/what-is-monero/privacy-dark.avif";
2025
2126
import Button from "@/components/ui/Button.astro";
2227
import IconLink from "@/components/ui/IconLink.astro";
@@ -26,7 +31,7 @@ import { readdirSync } from "fs";
2631
import { join } from "path";
2732
import { icons } from "@/utils/icons";
2833
29-
const { t, localizeHref, safeMarkdown } = Astro.locals;
34+
const { t, localizeHref, safeMarkdown, dir } = Astro.locals;
3035
3136
const i18nVttFiles = readdirSync(
3237
join(process.cwd(), "public", "media", "vtt", "msmsm"),
@@ -46,7 +51,7 @@ const getLanguageLabel = (lang: string): string => {
4651
>
4752
<TitleCard title={t("what-is-monero:hero.title")} />
4853
<PageContainer>
49-
<MediaSection as="div" class="content-section">
54+
<MediaSection as="div" class="content-section bleed-aside">
5055
<span class="eyebrow">{t("what-is-monero:sections.problem.eyebrow")}</span
5156
>
5257
<h2
@@ -59,12 +64,19 @@ const getLanguageLabel = (lang: string): string => {
5964
t("what-is-monero:sections.problem.content"),
6065
)}
6166
/>
62-
<Image slot="aside" src={surveillanceImage} alt="" format="avif" />
67+
<ThemeableImage
68+
class="top-blur"
69+
slot="aside"
70+
src={surveillanceImage}
71+
darkSrc={surveillanceImageDark}
72+
alt=""
73+
rtl={dir === "rtl"}
74+
/>
6375
</MediaSection>
6476

6577
<hr />
6678

67-
<MediaSection as="div" reverse class="content-section">
79+
<MediaSection as="div" reverse class="content-section bleed-aside">
6880
<span class="eyebrow"
6981
>{t("what-is-monero:sections.solution.eyebrow")}</span
7082
>
@@ -78,7 +90,14 @@ const getLanguageLabel = (lang: string): string => {
7890
t("what-is-monero:sections.solution.content"),
7991
)}
8092
/>
81-
<Image slot="aside" src={cryptoLock} alt="" format="avif" />
93+
<ThemeableImage
94+
class="top-blur"
95+
slot="aside"
96+
src={privacyImage}
97+
darkSrc={privacyImageDark}
98+
alt=""
99+
rtl={dir === "rtl"}
100+
/>
82101
</MediaSection>
83102

84103
<hr />
@@ -279,6 +298,14 @@ const getLanguageLabel = (lang: string): string => {
279298
</Layout>
280299

281300
<style>
301+
hr {
302+
margin: 0;
303+
}
304+
305+
p {
306+
margin-bottom: 0;
307+
}
308+
282309
.eyebrow {
283310
text-transform: uppercase;
284311
font-weight: var(--font-weight-semibold);
@@ -319,6 +346,18 @@ const getLanguageLabel = (lang: string): string => {
319346
margin-top: var(--space-2xl);
320347
}
321348

349+
.bleed-aside {
350+
margin-block: 0;
351+
352+
& :global(.content) {
353+
padding-block: var(--space-2xl);
354+
}
355+
}
356+
357+
.top-blur {
358+
mask-image: linear-gradient(to bottom, transparent, var(--bg-color) 0%);
359+
}
360+
322361
.final-cta {
323362
padding-block: var(--space-2xl);
324363

0 commit comments

Comments
 (0)