mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-09 00:19:13 +08:00
ui: add ref to both nav and panel
This commit is contained in:
parent
c91c03caaf
commit
53da15685b
@ -349,11 +349,14 @@ class Layout extends Component<LayoutProps, LayoutState> {
|
||||
viewMode: undefined,
|
||||
};
|
||||
|
||||
handleRef: React.RefObject<HTMLDivElement>;
|
||||
navRef: React.RefObject<HTMLDivElement>;
|
||||
|
||||
panelRef: React.RefObject<HTMLDivElement>;
|
||||
|
||||
constructor(props: LayoutProps) {
|
||||
super(props);
|
||||
this.handleRef = React.createRef();
|
||||
this.navRef = React.createRef();
|
||||
this.panelRef = React.createRef();
|
||||
const { bounds, options } = props;
|
||||
|
||||
const { resizerNav, resizerPanel } = persistence.get();
|
||||
@ -535,9 +538,9 @@ class Layout extends Component<LayoutProps, LayoutState> {
|
||||
onStart={this.setDragNav}
|
||||
onDrag={this.resizeNav}
|
||||
onStop={this.unsetDrag}
|
||||
nodeRef={this.handleRef}
|
||||
nodeRef={this.navRef}
|
||||
>
|
||||
<Handle ref={this.handleRef} axis="x" isDragging={isDragging === 'nav'} />
|
||||
<Handle ref={this.navRef} axis="x" isDragging={isDragging === 'nav'} />
|
||||
</Draggable>
|
||||
)}
|
||||
|
||||
@ -563,8 +566,10 @@ class Layout extends Component<LayoutProps, LayoutState> {
|
||||
onStart={this.setDragPanel}
|
||||
onDrag={this.resizePanel}
|
||||
onStop={this.unsetDrag}
|
||||
nodeRef={this.panelRef}
|
||||
>
|
||||
<Handle
|
||||
ref={this.panelRef}
|
||||
isDragging={isDragging === 'panel'}
|
||||
style={
|
||||
isPanelBottom
|
||||
|
Loading…
x
Reference in New Issue
Block a user