Skip to content

Commit 70fde43

Browse files
committed
Update versioning note + admonition
1 parent 38b340e commit 70fde43

File tree

5 files changed

+62
-26
lines changed

5 files changed

+62
-26
lines changed

client/modules/IDE/components/Admonition.jsx

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,19 @@
11
import React from 'react';
22
import PropTypes from 'prop-types';
3-
import { useTranslation } from 'react-i18next';
43

5-
export default function Admonition({ children }) {
6-
const { t } = useTranslation();
4+
export default function Admonition({ children, title }) {
75
return (
86
<div className="admonition">
9-
<h3 className="admonition__title">
10-
<span role="img" aria-label="Flower" className="admonition__icon">
11-
🌸
12-
</span>
13-
{t('Admonition.Note')}
14-
</h3>
7+
<p className="admonition__title">
8+
<strong>{title}</strong>
9+
</p>
1510
{children}
1611
</div>
1712
);
1813
}
1914

2015
Admonition.propTypes = {
16+
title: PropTypes.string.isRequired,
2117
children: PropTypes.node
2218
};
2319

client/modules/IDE/components/Preferences/index.jsx

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
import React, { useContext, useRef, useState } from 'react';
1+
import React, { useContext, useMemo, useRef, useState } from 'react';
22
import { Helmet } from 'react-helmet';
33
import { useDispatch, useSelector } from 'react-redux';
44
import { Tab, Tabs, TabList, TabPanel } from 'react-tabs';
55
import { useTranslation } from 'react-i18next';
6+
import ReactMarkdown from 'react-markdown';
7+
import PropTypes from 'prop-types';
68
import PlusIcon from '../../../../images/plus.svg';
79
import MinusIcon from '../../../../images/minus.svg';
810
import beepUrl from '../../../../sounds/audioAlert.mp3';
@@ -112,6 +114,37 @@ export default function Preferences() {
112114
cmRef.current?.updateFileContent(indexID, src);
113115
};
114116

117+
const markdownComponents = useMemo(() => {
118+
const ExternalLink = ({ children, ...props }) => (
119+
<a {...props} target="_blank">
120+
{children}
121+
</a>
122+
);
123+
ExternalLink.propTypes = {
124+
children: PropTypes.node
125+
};
126+
ExternalLink.defaultProps = {
127+
children: undefined
128+
};
129+
130+
const Paragraph = ({ children, ...props }) => (
131+
<p className="preference__paragraph" {...props}>
132+
{children}
133+
</p>
134+
);
135+
Paragraph.propTypes = {
136+
children: PropTypes.node
137+
};
138+
Paragraph.defaultProps = {
139+
children: undefined
140+
};
141+
142+
return {
143+
a: ExternalLink,
144+
p: Paragraph
145+
};
146+
}, []);
147+
115148
return (
116149
<section className="preferences">
117150
<Helmet>
@@ -505,14 +538,14 @@ export default function Preferences() {
505538
ref={pickerRef}
506539
onChangeVersion={onChangeVersion}
507540
/>
508-
<p className="preference__paragraph">
541+
<ReactMarkdown components={markdownComponents}>
509542
{t('Preferences.LibraryVersionInfo')}
510-
</p>
543+
</ReactMarkdown>
511544
</div>
512545
</>
513546
) : (
514547
<div>
515-
<Admonition>
548+
<Admonition title={t('Preferences.CustomVersionTitle')}>
516549
<p>{t('Preferences.CustomVersionInfo')}</p>
517550
</Admonition>
518551
<p className="preference__paragraph">

client/styles/abstracts/_variables.scss

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,9 @@ $themes: (
127127
hint-inline-text-color-light: $middle-light,
128128
hint-inline-text-color: $middle-gray,
129129

130-
admonition-border: #ED225D,
131-
admonition-background: #FFE4EC,
132-
admonition-text: #AF0E3D,
130+
admonition-border: #22C8ED,
131+
admonition-background: #E4F8FF,
132+
admonition-text: #0E86A1,
133133
),
134134
dark: (
135135
logo-color: $p5js-pink,
@@ -226,9 +226,9 @@ $themes: (
226226
hint-inline-text-color-light: $middle-gray,
227227
hint-inline-text-color: #cfcfcf,
228228

229-
admonition-border: #ED225D,
230-
admonition-background: #FFE4EC,
231-
admonition-text: #AF0E3D,
229+
admonition-border: #22C8ED,
230+
admonition-background: #1681b7,
231+
admonition-text: #E4F8FF,
232232
),
233233
contrast: (
234234
logo-color: $yellow,
@@ -325,9 +325,9 @@ $themes: (
325325
hint-inline-text-color-light: $middle-gray,
326326
hint-inline-text-color: #cfcfcf,
327327

328-
admonition-border: #ED225D,
329-
admonition-background: $white,
330-
admonition-text: #AF0E3D,
328+
admonition-border: #22C8ED,
329+
admonition-background: #1681b7,
330+
admonition-text: #ffffff,
331331
)
332332
);
333333

client/styles/components/_preferences.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,15 @@
6969

7070
.preference__paragraph {
7171
margin-bottom: #{math.div(10, $base-font-size)}rem;
72+
73+
& a {
74+
@include themify() {
75+
color: getThemifyVariable('button-background-hover-color');
76+
}
77+
}
78+
& a:hover {
79+
text-decoration: underline;
80+
}
7281
}
7382

7483
.preference__textarea {

translations/locales/en-US/translations.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,8 @@
217217
"TableText": "Table-text",
218218
"TableOutputARIA": "table output on",
219219
"LibraryVersion": "p5.js Version",
220-
"LibraryVersionInfo": "TODO Add helpful info about the new p5.js version, compatibility, etc.",
220+
"LibraryVersionInfo": "There's a [new 2.0 release](https://github.com/processing/p5.js/releases/) of p5.js available! It will become default in August, 2026, so take this time to test it out and report bugs. Interested in transitioning sketches from 1.x to 2.0? Check out the [compatibility & transition resources.](https://github.com/processing/p5.js-compatibility)",
221+
"CustomVersionTitle": "Managing your own libraries? Nice!",
221222
"CustomVersionInfo": "The version of p5.js is currently being managed in the code of index.html. This means it can't be adjusted from this tab.",
222223
"CustomVersionReset": "If you'd like to use the default libraries, you can replace the script tags in index.html with the following:",
223224
"SoundAddon": "p5.sound.js Addon",
@@ -666,8 +667,5 @@
666667
},
667668
"SkipLink": {
668669
"PlaySketch": "Skip to Play Sketch"
669-
},
670-
"Admonition": {
671-
"Note": "Note"
672670
}
673671
}

0 commit comments

Comments
 (0)