mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
30 lines
716 B
JavaScript
30 lines
716 B
JavaScript
// @flow
|
|
|
|
import React from 'react';
|
|
import { createPortal } from 'react-dom';
|
|
import Tree from './Tree';
|
|
import SelectedElement from './SelectedElement';
|
|
import styles from './Components.css';
|
|
|
|
export type Props = {|
|
|
portalContainer?: Element,
|
|
|};
|
|
|
|
export default function Components({ portalContainer }: Props) {
|
|
// TODO Flex wrappers below should be user resizable.
|
|
const children = (
|
|
<div className={styles.Components}>
|
|
<div className={styles.TreeWrapper}>
|
|
<Tree />
|
|
</div>
|
|
<div className={styles.SelectedElementWrapper}>
|
|
<SelectedElement />
|
|
</div>
|
|
</div>
|
|
);
|
|
|
|
return portalContainer != null
|
|
? createPortal(children, portalContainer)
|
|
: children;
|
|
}
|