mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 10:34:17 +00:00
removed RenderComponent
object
This commit is contained in:
parent
e1cab5ab22
commit
d2e6cfd17b
@ -6,7 +6,7 @@ import React from 'react'
|
||||
import { Rnd } from 'react-rnd'
|
||||
import { getDvaApp } from 'umi'
|
||||
import { Provider } from 'react-redux'
|
||||
|
||||
const { resolve, join } = require('path')
|
||||
|
||||
const renderDiv = document.createElement('div')
|
||||
class FloatComponent extends React.Component {
|
||||
@ -15,16 +15,20 @@ class FloatComponent extends React.Component {
|
||||
}
|
||||
|
||||
render() {
|
||||
const renderProps = this.props.renderBox ?? { }
|
||||
const defaultBoxWidth = renderProps.width ?? 500
|
||||
const defaultBoxHeight = renderProps.height ?? 600
|
||||
return (
|
||||
<Rnd
|
||||
default={{
|
||||
x: 500,
|
||||
y: 0,
|
||||
width: 320,
|
||||
height: "fit-content"
|
||||
x: ((window.innerWidth / 2) - defaultBoxWidth / 2 ),
|
||||
y: ((window.innerHeight / 2) - defaultBoxHeight / 2 ),
|
||||
width: defaultBoxWidth,
|
||||
height: defaultBoxHeight,
|
||||
}}
|
||||
maxHeight="60vh"
|
||||
style={{ overflowY: "scroll", overflowX: "hidden", zIndex: 1000 }}
|
||||
{...this.props.renderBox}
|
||||
>
|
||||
<div style={{ top: 0, position: "sticky", borderRadius: "8px 8px 0 0", background: "rgba(0, 0, 0, 0.4)", width: "100%", height: "35px", display: "flex", alignItems: "center", color: "#fff" }}>
|
||||
<div style={{ fontSize: "15px", color: "#fff", display: "flex", height: "100%", padding: "0 10px", alignItems: "center", marginRight: "5px" }}>
|
||||
@ -55,14 +59,16 @@ export function Open(props) {
|
||||
const divId = props.id ?? "floatComponent"
|
||||
const MountParent = document.getElementById("root")
|
||||
const thisChild = document.getElementById(divId)
|
||||
|
||||
|
||||
verbosity([props])
|
||||
|
||||
if (thisChild) {
|
||||
MountParent.removeChild(thisChild)
|
||||
}
|
||||
|
||||
let RenderComponent = <FloatComponent {...props} />
|
||||
MountParent.appendChild(renderDiv).setAttribute('id', divId)
|
||||
ReactDOM.render(<Provider store={dvaApp._store}><FloatComponent {...props} /></Provider>, renderDiv)
|
||||
ReactDOM.render(<Provider store={dvaApp._store}>{RenderComponent}</Provider>, renderDiv)
|
||||
}
|
||||
|
||||
export default Open
|
Loading…
x
Reference in New Issue
Block a user