Skip to content

Commit 009dfd1

Browse files
committed
Add experimentla icon + callout
1 parent 0805397 commit 009dfd1

File tree

5 files changed

+38
-7
lines changed

5 files changed

+38
-7
lines changed

public/icons/flask.svg

Lines changed: 3 additions & 0 deletions
Loading

src/components/ReferenceDirectoryWithFilter/index.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,18 @@ export const ReferenceDirectoryWithFilter = ({
9292
>
9393
<span
9494
class="text-body-mono group-hover:underline"
95-
dangerouslySetInnerHTML={{ __html: entry.data.title }}
96-
/>
95+
>
96+
{entry.data.beta && (
97+
<img
98+
className="inline-block align-center mr-2"
99+
src="/icons/flask.svg"
100+
alt="(Experimental)"
101+
width={16}
102+
height={16}
103+
/>
104+
)}
105+
<span dangerouslySetInnerHTML={{ __html: entry.data.title }} />
106+
</span>
97107
<p
98108
class="mt-1 text-sm"
99109
id={`${entry.data.title}-description`}

src/content/ui/en.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,3 +184,6 @@ calloutTitles:
184184
"Try this!": "Try this!"
185185
Tip: Tip
186186
Note: Note
187+
experimentalApi:
188+
title: This API is experimental
189+
description: Its behavior may change in a future version of p5.js.

src/layouts/ReferenceItemLayout.astro

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,21 @@ const seenParams: Record<string, true> = {};
8888
>
8989
<div class="content-grid mt-0 max-w-[770px]">
9090
<div class="col-span-9 xl:min-w-[1000px]">
91+
{entry.data.beta && (
92+
<div class="experimental">
93+
<h5>
94+
<img
95+
class="inline-block align-center"
96+
src="/icons/flask.svg"
97+
alt="(Experimental)"
98+
width={20}
99+
height={20}
100+
/>
101+
{t('experimentalApi', 'title')}
102+
</h5>
103+
<p>{t('experimentalApi', 'description')}</p>
104+
</div>
105+
)}
91106
<div
92107
set:html={description}
93108
class="[&_a]:text-type-magenta-dark [&_a]:!decoration-type-magenta-dark mb-xl reference-item rendered-markdown"

styles/global.scss

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ pre.code-box,
291291
white-space: break-spaces;
292292
}
293293

294-
.callout {
294+
.callout, .experimental {
295295
padding: var(--spacing-sm);
296296
border-radius: 20px;
297297
background-color: var(--bg-magenta-20);
@@ -301,11 +301,11 @@ pre.code-box,
301301
.dark-theme & {
302302
color: var(--type-black);
303303
}
304-
}
305304

306-
.callout h5 {
307-
font-weight: bold;
308-
margin-bottom: var(--spacing-sm);
305+
& h5 {
306+
font-weight: bold;
307+
margin-bottom: var(--spacing-sm);
308+
}
309309
}
310310

311311
.callout.callout-note {

0 commit comments

Comments
 (0)