This commit is contained in:
Víctor Losada Hernández 2025-01-03 20:15:30 +01:00
parent 0d1e9b3241
commit 361f85b945
3 changed files with 15 additions and 6 deletions

View File

@ -22,10 +22,10 @@ const Naturalcrit = React.createClass({
},
getInitialState: function () {
const initialTheme = typeof localStorage !== 'undefined' ? localStorage.getItem('theme') || 'light' : 'light';
return { theme: initialTheme };
return { theme: 'light' };
},
componentWillMount: function () {
global.domain = this.props.domain;
@ -51,6 +51,15 @@ const Naturalcrit = React.createClass({
});
},
componentDidMount: function () {
if (typeof localStorage !== 'undefined') {
const storedTheme = localStorage.getItem('theme');
if (storedTheme) {
this.setState({ theme: storedTheme });
}
}
},
toggleTheme: function () {
const newTheme = this.state.theme === 'light' ? 'dark' : 'light';
if (typeof localStorage !== 'undefined') {

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "naturalcrit",
"version": "2.3.0",
"version": "2.4.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "naturalcrit",
"version": "2.3.0",
"version": "2.4.0",
"hasInstallScript": true,
"license": "BSD-2-Clause",
"dependencies": {

View File

@ -1,7 +1,7 @@
{
"name": "naturalcrit",
"description": "Top-tier Tools for the discerning DM",
"version": "2.3.0",
"version": "2.4.0",
"scripts": {
"dev": "node scripts/dev.js",
"build": "node scripts/build.js",