parent
ab2da51276
commit
6a16d5f058
@ -0,0 +1,16 @@ |
||||
import React from 'react' |
||||
|
||||
function AbstractPanelHOC (WrappedComponent: any) { |
||||
return (WrappedComponent: any) => { |
||||
const WithAbstractPanel = (props: any) => { |
||||
return ( |
||||
<WrappedComponent |
||||
{...props} |
||||
/> |
||||
) |
||||
} |
||||
return WithAbstractPanel; |
||||
} |
||||
} |
||||
|
||||
export default AbstractPanelHOC |
@ -1,20 +1,20 @@ |
||||
.abstract-panel-plugins { |
||||
height: 100%; |
||||
} |
||||
.abstract-panel-plugItIn { |
||||
display : none; |
||||
height : 100%; |
||||
} |
||||
.abstract-panel-plugItIn > div { |
||||
overflow-y : auto; |
||||
overflow-x : hidden; |
||||
height : 100%; |
||||
width : 100%; |
||||
} |
||||
.abstract-panel-plugItIn.active { |
||||
display : block; |
||||
} |
||||
.abstract-panel-pluginsContainer { |
||||
height : 100%; |
||||
overflow-y : hidden; |
||||
} |
||||
.plugins { |
||||
height: 100%; |
||||
} |
||||
.plugItIn { |
||||
display : none; |
||||
height : 100%; |
||||
} |
||||
.plugItIn > div { |
||||
overflow-y : auto; |
||||
overflow-x : hidden; |
||||
height : 100%; |
||||
width : 100%; |
||||
} |
||||
.plugItIn.active { |
||||
display : block; |
||||
} |
||||
.pluginsContainer { |
||||
height : 100%; |
||||
overflow-y : hidden; |
||||
} |
@ -1,19 +1,56 @@ |
||||
import React from 'react' // eslint-disable-line
|
||||
import React, { useEffect, useState } from 'react' // eslint-disable-line
|
||||
import './remix-ui-abstract-panel.module.css'; |
||||
import parse from 'html-react-parser' |
||||
|
||||
/* eslint-disable-next-line */ |
||||
export interface RemixUiAbstractPanelProps { |
||||
reactView: any |
||||
reactView: any, |
||||
plugin: any |
||||
} |
||||
|
||||
export function RemixUiAbstractPanel(props: RemixUiAbstractPanelProps) { |
||||
|
||||
const [loading, setLoading] = useState(false); |
||||
useEffect(() => { |
||||
console.log({ activePlugin: props.plugin.active }) |
||||
},[props.plugin.active]) |
||||
|
||||
useEffect(() => { |
||||
Object.keys(props.plugin.contents).map((key: string) => { |
||||
const view = props.plugin.contents[key] |
||||
|
||||
view.addEventListener('load', () => { |
||||
setLoading(true) |
||||
}) |
||||
setLoading(false) |
||||
}) |
||||
} |
||||
, [loading]) |
||||
|
||||
return ( |
||||
<div id="plugins" className="plugins"> |
||||
{console.log({ view: props.plugin })} |
||||
good |
||||
{ |
||||
Object.keys(props.plugin.contents).map((key: string, index: number) => { |
||||
|
||||
const plugin = props.plugin.contents[key] |
||||
const active = props.plugin.active === key |
||||
console.log({ plugin: plugin.id, active: props.plugin.active }) |
||||
|
||||
return ( |
||||
<div className="plugItIn" key={ index }> |
||||
{loading && ( |
||||
<div className="d-flex justify-content-center align-items-center"> |
||||
<div className="spinner-border" role="status"> |
||||
<span className="sr-only">Loading...</span> |
||||
</div> |
||||
</div> |
||||
)} |
||||
</div> |
||||
) |
||||
}) |
||||
} |
||||
</div> |
||||
); |
||||
) |
||||
} |
||||
|
||||
export default RemixUiAbstractPanel; |
||||
|
Loading…
Reference in new issue