support global visibility method

This commit is contained in:
SrGooglo 2023-05-28 01:25:47 +00:00
parent b2e920af1d
commit 1b2dc08431
2 changed files with 24 additions and 1 deletions

View File

@ -1,4 +1,5 @@
import React from "react" import React from "react"
import classnames from "classnames"
import { DOMWindow } from "components/RenderWindow" import { DOMWindow } from "components/RenderWindow"
import "./index.less" import "./index.less"
@ -34,6 +35,7 @@ class FloatingStackItem extends React.PureComponent {
export default class FloatingStack extends React.Component { export default class FloatingStack extends React.Component {
state = { state = {
renders: [], renders: [],
globalVisibility: true,
} }
public = { public = {
@ -77,6 +79,15 @@ export default class FloatingStack extends React.Component {
}) })
return true return true
},
toogleGlobalVisibility: (to) => {
if (typeof to !== "boolean") {
to = !this.state.globalVisibility
}
this.setState({
globalVisibility: to,
})
} }
} }
@ -90,7 +101,14 @@ export default class FloatingStack extends React.Component {
} }
render() { render() {
return <div className="floating_stack"> return <div
className={classnames(
"floating_stack",
{
["hidden"]: !this.state.globalVisibility,
}
)}
>
{ {
this.state.renders.map((item) => { this.state.renders.map((item) => {
return <FloatingStackItem id={item.id}> return <FloatingStackItem id={item.id}>

View File

@ -18,6 +18,11 @@
margin: 20px; margin: 20px;
transition: all 0.3s ease-in-out; transition: all 0.3s ease-in-out;
&.hidden {
transform: translateX(100%);
opacity: 0;
}
} }
.floating_stack_item { .floating_stack_item {