mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-11 03:24:16 +00:00
support global visibility method
This commit is contained in:
parent
b2e920af1d
commit
1b2dc08431
@ -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}>
|
||||||
|
@ -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 {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user