This commit is contained in:
srgooglo 2025-07-07 16:19:42 +02:00
parent dd2e1b5070
commit 44c2500491

View File

@ -23,9 +23,7 @@ export default class Layout extends React.PureComponent {
const transitionLayer = document.getElementById("transitionLayer") const transitionLayer = document.getElementById("transitionLayer")
if (!transitionLayer) { if (!transitionLayer) {
console.warn( console.warn("transitionLayer not found, no animation will be played")
"transitionLayer not found, no animation will be played",
)
return false return false
} }
@ -42,9 +40,7 @@ export default class Layout extends React.PureComponent {
const transitionLayer = document.getElementById("transitionLayer") const transitionLayer = document.getElementById("transitionLayer")
if (!transitionLayer) { if (!transitionLayer) {
console.warn( console.warn("transitionLayer not found, no animation will be played")
"transitionLayer not found, no animation will be played",
)
return false return false
} }
@ -114,10 +110,7 @@ export default class Layout extends React.PureComponent {
) )
}, },
toggleMobileStyle: (to) => { toggleMobileStyle: (to) => {
return this.layoutInterface.toggleRootContainerClassname( return this.layoutInterface.toggleRootContainerClassname("mobile", to)
"mobile",
to,
)
}, },
toggleReducedAnimations: (to) => { toggleReducedAnimations: (to) => {
return this.layoutInterface.toggleRootContainerClassname( return this.layoutInterface.toggleRootContainerClassname(
@ -150,17 +143,14 @@ export default class Layout extends React.PureComponent {
) )
}, },
toggleRootContainerClassname: (classname, to) => { toggleRootContainerClassname: (classname, to) => {
const root = document.documentElement const root = document.documentElement
if (!root) { if (!root) {
console.error("root not found") console.error("root not found")
return false return false
} }
to = to = typeof to === "boolean" ? to : !root.classList.contains(classname)
typeof to === "boolean"
? to
: !root.classList.contains(classname)
if (root.classList.contains(classname) === to) { if (root.classList.contains(classname) === to) {
// ignore // ignore
@ -208,10 +198,9 @@ export default class Layout extends React.PureComponent {
if (this.state.renderError) { if (this.state.renderError) {
if (this.props.staticRenders?.RenderError) { if (this.props.staticRenders?.RenderError) {
return React.createElement( return React.createElement(this.props.staticRenders?.RenderError, {
this.props.staticRenders?.RenderError, error: this.state.renderError,
{ error: this.state.renderError }, })
)
} }
return JSON.stringify(this.state.renderError) return JSON.stringify(this.state.renderError)