mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00
doc: make theme consistent across api and other docs
Since website based on 2 different repos, there was an inconsistency in theme selection, so we had 2 independant theme props. Now only one stored in local storage is a single source of truth PR-URL: https://github.com/nodejs/node/pull/50877 Reviewed-By: Claudio Wunder <cwunder@gnome.org> Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io>
This commit is contained in:
parent
4466deeb34
commit
62fc950e96
3 changed files with 17 additions and 10 deletions
|
@ -462,6 +462,12 @@ make docopen
|
||||||
This will open a file URL to a one-page version of all the browsable HTML
|
This will open a file URL to a one-page version of all the browsable HTML
|
||||||
documents using the default browser.
|
documents using the default browser.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
make docclean
|
||||||
|
```
|
||||||
|
|
||||||
|
This will clean previously built doc.
|
||||||
|
|
||||||
To test if Node.js was built correctly:
|
To test if Node.js was built correctly:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
|
|
||||||
{
|
{
|
||||||
function setupTheme() {
|
function setupTheme() {
|
||||||
const kCustomPreference = 'customDarkTheme';
|
const storedTheme = localStorage.getItem('theme');
|
||||||
const userSettings = sessionStorage.getItem(kCustomPreference);
|
|
||||||
const themeToggleButton = document.getElementById('theme-toggle-btn');
|
const themeToggleButton = document.getElementById('theme-toggle-btn');
|
||||||
|
|
||||||
if (userSettings === null && window.matchMedia) {
|
// Follow operating system theme preference
|
||||||
|
if (storedTheme === null && window.matchMedia) {
|
||||||
const mq = window.matchMedia('(prefers-color-scheme: dark)');
|
const mq = window.matchMedia('(prefers-color-scheme: dark)');
|
||||||
|
|
||||||
if ('onchange' in mq) {
|
if ('onchange' in mq) {
|
||||||
|
@ -28,16 +28,16 @@
|
||||||
if (mq.matches) {
|
if (mq.matches) {
|
||||||
document.documentElement.classList.add('dark-mode');
|
document.documentElement.classList.add('dark-mode');
|
||||||
}
|
}
|
||||||
} else if (userSettings === 'true') {
|
} else if (storedTheme === 'dark') {
|
||||||
document.documentElement.classList.add('dark-mode');
|
document.documentElement.classList.add('dark-mode');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (themeToggleButton) {
|
if (themeToggleButton) {
|
||||||
themeToggleButton.hidden = false;
|
themeToggleButton.hidden = false;
|
||||||
themeToggleButton.addEventListener('click', function() {
|
themeToggleButton.addEventListener('click', function() {
|
||||||
sessionStorage.setItem(
|
localStorage.setItem(
|
||||||
kCustomPreference,
|
'theme',
|
||||||
document.documentElement.classList.toggle('dark-mode'),
|
document.documentElement.classList.toggle('dark-mode') ? 'dark' : 'light',
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -532,9 +532,10 @@ The TSC serves as the final arbiter where required.
|
||||||
[build](https://github.com/nodejs/build/issues) repositories, open new
|
[build](https://github.com/nodejs/build/issues) repositories, open new
|
||||||
issues. Run a new CI any time someone pushes new code to the pull request.
|
issues. Run a new CI any time someone pushes new code to the pull request.
|
||||||
4. Check that the commit message adheres to [commit message guidelines][].
|
4. Check that the commit message adheres to [commit message guidelines][].
|
||||||
5. Add all necessary [metadata](#metadata) to commit messages before landing. If
|
5. Add all necessary [metadata][git-node-metadata] to commit messages before
|
||||||
you are unsure exactly how to format the commit messages, use the commit log
|
landing. If you are unsure exactly how to format the commit messages, use
|
||||||
as a reference. See [this commit][commit-example] as an example.
|
the commit log as a reference. See [this commit][commit-example] as an
|
||||||
|
example.
|
||||||
|
|
||||||
For pull requests from first-time contributors, be
|
For pull requests from first-time contributors, be
|
||||||
[welcoming](#welcoming-first-time-contributors). Also, verify that their git
|
[welcoming](#welcoming-first-time-contributors). Also, verify that their git
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue