Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Update PIG examples to work with react-dnd 3.x #1214

Merged
merged 1 commit into from
Aug 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 22 additions & 21 deletions src/components/DataBrowserHeader/DataBrowserHeader.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,36 +8,37 @@
import DataBrowserHeader from 'components/DataBrowserHeader/DataBrowserHeader.react';
import HTML5Backend from 'react-dnd-html5-backend';
import React from 'react';
import { DragDropContext } from 'react-dnd';
import { DndProvider } from 'react-dnd'

export const component = DataBrowserHeader;

let lightBg = { background: 'rgba(224,224,234,0.10)' };

@DragDropContext(HTML5Backend)
class HeadersDemo extends React.Component {
render() {
return (
<div style={{ height: 30, background: '#66637A' }}>
<div style={{ float: 'left', width: 140 }}>
<DataBrowserHeader name='objectId' type='Special' />
<DndProvider backend={HTML5Backend}>
<div style={{ height: 30, background: '#66637A' }}>
<div style={{ float: 'left', width: 140 }}>
<DataBrowserHeader name='objectId' type='Special' />
</div>
<div style={{ float: 'left', width: 140 }}>
<DataBrowserHeader name='createdAt' type='Date' style={lightBg} />
</div>
<div style={{ float: 'left', width: 140 }}>
<DataBrowserHeader name='updatedAt' type='Date' />
</div>
<div style={{ float: 'left', width: 140 }}>
<DataBrowserHeader name='name' type='String' style={lightBg} />
</div>
<div style={{ float: 'left', width: 140 }}>
<DataBrowserHeader name='owner' type='Pointer<_User>' />
</div>
<div style={{ float: 'left', width: 140 }}>
<DataBrowserHeader name='really_long_column_name_that_overflows' type='String' style={lightBg} />
</div>
</div>
<div style={{ float: 'left', width: 140 }}>
<DataBrowserHeader name='createdAt' type='Date' style={lightBg} />
</div>
<div style={{ float: 'left', width: 140 }}>
<DataBrowserHeader name='updatedAt' type='Date' />
</div>
<div style={{ float: 'left', width: 140 }}>
<DataBrowserHeader name='name' type='String' style={lightBg} />
</div>
<div style={{ float: 'left', width: 140 }}>
<DataBrowserHeader name='owner' type='Pointer<_User>' />
</div>
<div style={{ float: 'left', width: 140 }}>
<DataBrowserHeader name='really_long_column_name_that_overflows' type='String' style={lightBg} />
</div>
</div>
</DndProvider>
);
}
}
Expand Down
55 changes: 28 additions & 27 deletions src/components/DragHandle/DragHandle.example.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import DataBrowserHeader from 'components/DataBrowserHeader/DataBrowserHeader.
import DragHandle from 'components/DragHandle/DragHandle.react';
import HTML5Backend from 'react-dnd-html5-backend';
import React from 'react';
import { DragDropContext } from 'react-dnd';
import { DndProvider } from 'react-dnd'

export const component = DragHandle;

Expand Down Expand Up @@ -64,7 +64,6 @@ let handleStyle = {
cursor: 'ew-resize'
};

@DragDropContext(HTML5Backend)
class HeadersDemo extends React.Component {
constructor() {
super();
Expand All @@ -90,32 +89,34 @@ class HeadersDemo extends React.Component {

render() {
return (
<div style={{ height: 30, background: '#66637A', whiteSpace: 'nowrap' }}>
<div style={{ display: 'inline-block', width: this.state.widths[0] }}>
<DataBrowserHeader name='objectId' type='Special' />
<DndProvider backend={HTML5Backend}>
<div style={{ height: 30, background: '#66637A', whiteSpace: 'nowrap' }}>
<div style={{ display: 'inline-block', width: this.state.widths[0] }}>
<DataBrowserHeader name='objectId' type='Special' />
</div>
<DragHandle style={handleStyle} onDrag={this.handleDrag.bind(this, 0)} />
<div style={{ display: 'inline-block', width: this.state.widths[1] }}>
<DataBrowserHeader name='createdAt' type='Date' style={lightBg} />
</div>
<DragHandle style={handleStyle} onDrag={this.handleDrag.bind(this, 1)} />
<div style={{ display: 'inline-block', width: this.state.widths[2] }}>
<DataBrowserHeader name='updatedAt' type='Date' />
</div>
<DragHandle style={handleStyle} onDrag={this.handleDrag.bind(this, 2)} />
<div style={{ display: 'inline-block', width: this.state.widths[3] }}>
<DataBrowserHeader name='name' type='String' style={lightBg} />
</div>
<DragHandle style={handleStyle} onDrag={this.handleDrag.bind(this, 3)} />
<div style={{ display: 'inline-block', width: this.state.widths[4] }}>
<DataBrowserHeader name='owner' type='Pointer<_User>' />
</div>
<DragHandle style={handleStyle} onDrag={this.handleDrag.bind(this, 4)} />
<div style={{ display: 'inline-block', width: this.state.widths[5] }}>
<DataBrowserHeader name='really_long_column_name_that_overflows' type='String' style={lightBg} />
</div>
<DragHandle style={handleStyle} onDrag={this.handleDrag.bind(this, 5)} />
</div>
<DragHandle style={handleStyle} onDrag={this.handleDrag.bind(this, 0)} />
<div style={{ display: 'inline-block', width: this.state.widths[1] }}>
<DataBrowserHeader name='createdAt' type='Date' style={lightBg} />
</div>
<DragHandle style={handleStyle} onDrag={this.handleDrag.bind(this, 1)} />
<div style={{ display: 'inline-block', width: this.state.widths[2] }}>
<DataBrowserHeader name='updatedAt' type='Date' />
</div>
<DragHandle style={handleStyle} onDrag={this.handleDrag.bind(this, 2)} />
<div style={{ display: 'inline-block', width: this.state.widths[3] }}>
<DataBrowserHeader name='name' type='String' style={lightBg} />
</div>
<DragHandle style={handleStyle} onDrag={this.handleDrag.bind(this, 3)} />
<div style={{ display: 'inline-block', width: this.state.widths[4] }}>
<DataBrowserHeader name='owner' type='Pointer<_User>' />
</div>
<DragHandle style={handleStyle} onDrag={this.handleDrag.bind(this, 4)} />
<div style={{ display: 'inline-block', width: this.state.widths[5] }}>
<DataBrowserHeader name='really_long_column_name_that_overflows' type='String' style={lightBg} />
</div>
<DragHandle style={handleStyle} onDrag={this.handleDrag.bind(this, 5)} />
</div>
</DndProvider>
);
}
}
Expand Down