File tree 5 files changed +27
-18
lines changed
5 files changed +27
-18
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ module.exports = React.createClass
8
8
margin : 10
9
9
10
10
render : ->
11
- <div style = {" max-width " : ' 1200px' , margin : ' 0 auto' }>
11
+ <div style = {" maxWidth " : ' 1200px' , margin : ' 0 auto' }>
12
12
<h1 >react- component- gallery</h1 >
13
13
<a href = " https://github.com/KyleAMathews/react-component-gallery" >Code on Github</a >
14
14
<p >Create a perfect component gallery every time whatever the size of the
@@ -75,7 +75,7 @@ module.exports = React.createClass
75
75
background : " rgba(0,0,0,0.5)"
76
76
bottom : 0
77
77
left : 0
78
- " line-height " : " 30px"
78
+ " lineHeight " : " 30px"
79
79
height : " 30px"
80
80
padding : " 0 10px"
81
81
color : " white"
Original file line number Diff line number Diff line change 1
1
React = require (' react' )
2
2
Examples = require ' ./examples'
3
3
4
- React .renderComponent (<Examples />, document .body )
4
+ React .render (<Examples />, document .body )
Original file line number Diff line number Diff line change 7
7
"url" : " https://github.com/KyleAMathews/react-component-gallery/issues"
8
8
},
9
9
"dependencies" : {
10
- "react-component-width-mixin" : " ^1.1.0 "
10
+ "react-component-width-mixin" : " ^1.1.2 "
11
11
},
12
12
"devDependencies" : {
13
- "cjsx-loader" : " ^0.3 .0" ,
13
+ "cjsx-loader" : " ^1.1 .0" ,
14
14
"coffee-loader" : " ^0.7.2" ,
15
- "coffee-react" : " ^1.0 .2" ,
15
+ "coffee-react" : " ^2.1 .2" ,
16
16
"coffee-script" : " ^1.8.0" ,
17
17
"css-loader" : " ^0.9.0" ,
18
- "gulp" : " ^3.8.8 " ,
19
- "react-hot-loader" : " ^0.4.5 " ,
20
- "style-loader" : " ^0.8.1 " ,
18
+ "gulp" : " ^3.8.10 " ,
19
+ "react-hot-loader" : " ^0.5.0 " ,
20
+ "style-loader" : " ^0.8.2 " ,
21
21
"underscore" : " ^1.7.0" ,
22
- "webpack" : " ^1.4.4 " ,
23
- "webpack-dev-server" : " ^1.6.5 "
22
+ "webpack" : " ^1.4.13 " ,
23
+ "webpack-dev-server" : " ^1.6.6 "
24
24
},
25
25
"homepage" : " https://github.com/KyleAMathews/react-component-gallery" ,
26
26
"keywords" : [
38
38
"url" : " https://github.com/KyleAMathews/react-component-gallery.git"
39
39
},
40
40
"scripts" : {
41
- "test" : " echo \" Error: no test specified\" && exit 1"
41
+ "test" : " echo \" Error: no test specified\" && exit 1" ,
42
+ "watch" : " ./node_modules/.bin/webpack-dev-server --hot"
42
43
}
43
44
}
Original file line number Diff line number Diff line change @@ -7,14 +7,22 @@ module.exports = React.createClass
7
7
8
8
propTypes :
9
9
children : React .PropTypes .any .isRequired
10
+ disableServerRender : React .PropTypes .bool
10
11
11
12
getDefaultProps : ->
12
13
margin : 10
13
14
targetWidth : 200
14
15
widthHeightRatio : 1
16
+ disableServerRender : false
15
17
16
18
render : ->
17
- if @state .componentWidth isnt 0
19
+ # If we don't know the component width, there's nothing we can do.
20
+ if @state .componentWidth is 0
21
+ <div />
22
+ # If we're server rendering and the user has disalbed server rendering.
23
+ else if not @ isMounted () and @props .disableServerRender
24
+ <div />
25
+ else
18
26
[componentWidth , componentsPerRow ] = @ calculateComponentWidth ()
19
27
return (
20
28
<div className = " component-gallery #{ @props .className } " style = {{overflow : " hidden" }}>
@@ -44,8 +52,6 @@ module.exports = React.createClass
44
52
)}
45
53
</div >
46
54
)
47
- else
48
- <div />
49
55
50
56
calculateComponentWidth : ->
51
57
_calcComponentWidth = (adjustComponentsPerRow = 0 ) =>
Original file line number Diff line number Diff line change 1
1
var path = require ( 'path' ) ;
2
2
var webpack = require ( 'webpack' ) ;
3
3
4
-
5
4
module . exports = {
6
5
entry : [
7
6
"webpack-dev-server/client?http://0.0.0.0:8080" ,
8
- 'webpack/hot/dev-server' ,
7
+ 'webpack/hot/only- dev-server' ,
9
8
'./examples/index'
10
9
] ,
11
- contentBase : './examples/' ,
10
+ devServer : {
11
+ contentBase : './examples/'
12
+ } ,
12
13
devtool : "eval" ,
13
14
debug : true ,
14
15
output : {
@@ -20,6 +21,7 @@ module.exports = {
20
21
} ,
21
22
plugins : [
22
23
new webpack . HotModuleReplacementPlugin ( ) ,
24
+ new webpack . NoErrorsPlugin ( ) ,
23
25
new webpack . IgnorePlugin ( / u n ~ $ / )
24
26
] ,
25
27
resolve : {
You can’t perform that action at this time.
0 commit comments