mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-10 02:54:15 +00:00
support attach renders
This commit is contained in:
parent
19e21fd130
commit
728f33b01a
@ -13,6 +13,7 @@ import "./index.less"
|
|||||||
export default class ToolsBar extends React.Component {
|
export default class ToolsBar extends React.Component {
|
||||||
state = {
|
state = {
|
||||||
visible: false,
|
visible: false,
|
||||||
|
renders: [],
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
@ -35,6 +36,24 @@ export default class ToolsBar extends React.Component {
|
|||||||
visible: to ?? !this.state.visible,
|
visible: to ?? !this.state.visible,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
attachRender: (id, component, props) => {
|
||||||
|
this.setState({
|
||||||
|
renders: [...this.state.renders, {
|
||||||
|
id: id,
|
||||||
|
component: component,
|
||||||
|
props: props,
|
||||||
|
}],
|
||||||
|
})
|
||||||
|
|
||||||
|
return component
|
||||||
|
},
|
||||||
|
detachRender: (id) => {
|
||||||
|
this.setState({
|
||||||
|
renders: this.state.renders.filter((render) => render.id !== id),
|
||||||
|
})
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
@ -59,8 +78,6 @@ export default class ToolsBar extends React.Component {
|
|||||||
}
|
}
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<FeaturedEventsAnnouncements />
|
|
||||||
|
|
||||||
<div className="card" id="trendings">
|
<div className="card" id="trendings">
|
||||||
<div className="header">
|
<div className="header">
|
||||||
<h2>
|
<h2>
|
||||||
@ -83,7 +100,17 @@ export default class ToolsBar extends React.Component {
|
|||||||
<ConnectedFriends />
|
<ConnectedFriends />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<FeaturedEventsAnnouncements />
|
||||||
|
|
||||||
<WidgetsWrapper />
|
<WidgetsWrapper />
|
||||||
|
|
||||||
|
<div className="attached_renders">
|
||||||
|
{
|
||||||
|
this.state.renders.map((render) => {
|
||||||
|
return React.createElement(render.component, render.props)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}}
|
}}
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
right: 0;
|
right: 0;
|
||||||
|
|
||||||
max-width: 20vw;
|
max-width: 20vw;
|
||||||
|
min-width: 320px;
|
||||||
|
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
height: 100dvh;
|
height: 100dvh;
|
||||||
@ -80,4 +81,23 @@
|
|||||||
z-index: 45;
|
z-index: 45;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.attached_renders {
|
||||||
|
position: sticky;
|
||||||
|
|
||||||
|
bottom: 0;
|
||||||
|
right: 0;
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-end;
|
||||||
|
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
height: 100%;
|
||||||
|
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user