Skip to content

Commit bce806b

Browse files
committed
Fix some styles, import react-virtualized style
1 parent 76de4be commit bce806b

9 files changed

+66
-14
lines changed

Diff for: src/examples/basicExample/app.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,14 @@ const App = React.createClass({
99
treeData: [
1010
{
1111
id: 'b12314',
12-
title: 'Joe',
12+
title: 'Beast Man',
1313
subtitle: 'Pancakes',
1414
expanded: true,
1515
children: [
1616
{
1717
id: 1,
18-
title: 'Really Long Name Nicholas Who Always Got' +
19-
' Picked on in School For His Really Long Name',
20-
subtitle: 'Really good icebreaker, though',
18+
title: 'Joe',
19+
subtitle: 'Pancakes',
2120
children: [], // null or undefined also ok
2221
},
2322
{
@@ -48,8 +47,9 @@ const App = React.createClass({
4847
},
4948
{
5049
id: 'b12316',
51-
title: 'Beast Man',
52-
subtitle: 'Pancakes',
50+
title: 'Really Long Name Nicholas Who Always Got' +
51+
' Picked on in School For His Really Long Name',
52+
subtitle: 'Really good icebreaker, though',
5353
children: [
5454
{
5555
title: 'Bruce',
@@ -98,7 +98,7 @@ const App = React.createClass({
9898
</span>
9999
<h3>Demo</h3>
100100

101-
<div style={{ height: 500 }}>
101+
<div style={{ height: 385 }}>
102102
<SortableTree
103103
treeData={this.state.treeData}
104104
updateTreeData={treeData => this.setState({ treeData })}

Diff for: src/examples/basicExample/stylesheets/app.scss

+4
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,7 @@
88
.main-content {
99
box-sizing: border-box;
1010
}
11+
12+
body {
13+
background-color: #FAFAFA;
14+
}

Diff for: src/node-renderer-default.scss

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
display: flex;
2222
align-items: center;
2323
justify-content: space-between;
24+
background-color: white;
2425
}
2526

2627
.rowLabel {

Diff for: src/react-sortable-tree.js

+12-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import React, { Component, PropTypes } from 'react';
88
import { AutoSizer, VirtualScroll } from 'react-virtualized';
9+
import 'react-virtualized/styles.css';
910
import TreeNode from './tree-node';
1011
import {
1112
walk,
@@ -172,12 +173,13 @@ class ReactSortableTree extends Component {
172173

173174
render() {
174175
const {
176+
style = {},
175177
rowHeight,
176178
} = this.props;
177179
const { rows } = this.state;
178180

179181
return (
180-
<div className={styles.tree}>
182+
<div className={styles.tree} style={{ height: '100%', ...style }}>
181183
<AutoSizer>
182184
{({height, width}) => (
183185
<VirtualScroll
@@ -229,8 +231,16 @@ class ReactSortableTree extends Component {
229231
ReactSortableTree.propTypes = {
230232
treeData: PropTypes.arrayOf(PropTypes.object).isRequired,
231233
changeData: PropTypes.func,
234+
235+
// Callback for move operation.
236+
// Called as moveNode({ node, path, newParentPath, newChildIndex })
232237
moveNode: PropTypes.func,
233-
rowHeight: PropTypes.oneOfType([ PropTypes.number, PropTypes.func ]), // Used for react-virtualized
238+
239+
// Style applied to the container wrapping the tree (style defaults to {height: '100%'})
240+
style: PropTypes.object,
241+
242+
// Height of each node row, used for react-virtualized
243+
rowHeight: PropTypes.oneOfType([ PropTypes.number, PropTypes.func ]),
234244

235245
scaffoldBlockPxWidth: PropTypes.number,
236246

Diff for: src/react-sortable-tree.scss

+10-5
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,23 @@
22
* The container holding the VirtualScroll
33
*/
44
.tree {
5-
height: 100%;
6-
overflow: hidden;
7-
* {
8-
box-sizing: border-box;
9-
}
5+
/*! This comment keeps Sass from deleting the empty rule */
106
}
117

128
/**
139
* Extra class applied to VirtualScroll through className prop
1410
*/
1511
.virtualScrollOverride {
1612
overflow-x: visible !important;
13+
overflow-y: auto !important;
14+
15+
* {
16+
box-sizing: border-box;
17+
}
18+
}
19+
20+
:global .Grid__innerScrollContainer {
21+
overflow: visible;
1722
}
1823

1924
:global .Grid {

Diff for: webpack.config.demo.babel.js

+8
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,14 @@ module.exports = {
4747
],
4848
include: path.join(__dirname, 'src')
4949
},
50+
{
51+
test: /\.css$/,
52+
loaders: [
53+
'style-loader',
54+
'css-loader',
55+
'postcss-loader',
56+
],
57+
},
5058
{
5159
test: /\.(jpe?g|png|gif)$/,
5260
loaders: [

Diff for: webpack.config.dev.babel.js

+8
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ module.exports = {
4343
],
4444
include: path.join(__dirname, 'src')
4545
},
46+
{
47+
test: /\.css$/,
48+
loaders: [
49+
'style-loader',
50+
'css-loader',
51+
'postcss-loader',
52+
],
53+
},
4654
{
4755
test: /\.(jpe?g|png|gif)$/,
4856
loaders: [

Diff for: webpack.config.test.babel.js

+8
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@ module.exports = {
4949
],
5050
include: path.join(__dirname, 'src')
5151
},
52+
{
53+
test: /\.css$/,
54+
loaders: [
55+
'style-loader',
56+
'css-loader',
57+
'postcss-loader',
58+
],
59+
},
5260
{
5361
test: /\.(jpe?g|png|gif)$/,
5462
loaders: [

Diff for: webpack.config.umd.babel.js

+8
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@ module.exports = {
5959
],
6060
include: path.join(__dirname, 'src')
6161
},
62+
{
63+
test: /\.css$/,
64+
loaders: [
65+
'style-loader',
66+
'css-loader',
67+
'postcss-loader',
68+
],
69+
},
6270
]
6371
}
6472
};

0 commit comments

Comments
 (0)