make width of DetailsSidebar configurable

Summary:
The `DetailsSidebar` has a fixed width of 300px. For some plugins it makes sense to specify a larger width for the sidebar, to show more content in it.

Usage:
```
<DetailSidebar width={500}>...</DetailSidebar>
```

Reviewed By: passy

Differential Revision: D12924525

fbshipit-source-id: 889d799017a6d3d53f6d32510863b4838a928fba
This commit is contained in:
Daniel Büchele
2018-11-06 05:36:20 -08:00
committed by Facebook Github Bot
parent 9fb3a56303
commit 2088153ffb

View File

@@ -16,6 +16,7 @@ type Props = {
rightSidebarVisible: boolean, rightSidebarVisible: boolean,
rightSidebarAvailable: boolean, rightSidebarAvailable: boolean,
toggleRightSidebarAvailable: (visible: boolean) => void, toggleRightSidebarAvailable: (visible: boolean) => void,
width?: number,
}; };
class DetailSidebar extends React.Component<Props> { class DetailSidebar extends React.Component<Props> {
@@ -41,7 +42,7 @@ class DetailSidebar extends React.Component<Props> {
this.props.rightSidebarVisible && this.props.rightSidebarVisible &&
domNode && domNode &&
ReactDOM.createPortal( ReactDOM.createPortal(
<Sidebar width={300} position="right"> <Sidebar width={this.props.width || 300} position="right">
{this.props.children} {this.props.children}
</Sidebar>, </Sidebar>,
domNode, domNode,