-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Classes & Props: Container/Grid/Row/Column #34
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ import classNames from 'classnames'; | |
* </Container> | ||
*/ | ||
|
||
class Container extends Component { | ||
export default class Container extends Component { | ||
static propTypes = { | ||
children: PropTypes.node, | ||
className: PropTypes.string, | ||
|
@@ -21,16 +21,14 @@ class Container extends Component { | |
render() { | ||
let classes = classNames( | ||
'sd-container', | ||
this.props.className, | ||
'ui', | ||
'container' | ||
this.props.className, | ||
'container', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. insert className between |
||
); | ||
return ( | ||
<div className={classes}> | ||
<div {...this.props} className={classes}> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. spread props |
||
{this.props.children} | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
export default Container; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ import classNames from 'classnames'; | |
import React, {Component, PropTypes} from 'react'; | ||
import numberToWord from 'src/utils/numberToWord'; | ||
|
||
class Column extends Component { | ||
export default class Column extends Component { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. inline export |
||
static propTypes = { | ||
children: PropTypes.node, | ||
className: PropTypes.string, | ||
|
@@ -13,15 +13,14 @@ class Column extends Component { | |
render() { | ||
let classes = classNames( | ||
'sd-column', | ||
this.props.className, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. inherit classes |
||
this.props.width && numberToWord(this.props.width) + ' wide', | ||
'column' | ||
); | ||
return ( | ||
<div className={classes} style={this.props.style}> | ||
<div {...this.props} className={classes}> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. spread props |
||
{this.props.children} | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
export default Column; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,23 @@ | ||
import classNames from 'classnames'; | ||
import React, {Component, PropTypes} from 'react'; | ||
|
||
class Grid extends Component { | ||
export default class Grid extends Component { | ||
static propTypes = { | ||
children: PropTypes.node, | ||
className: PropTypes.string, | ||
divided: PropTypes.bool, | ||
padded: PropTypes.bool, | ||
stretched: PropTypes.bool, | ||
style: PropTypes.object, | ||
}; | ||
|
||
render() { | ||
let classes = classNames( | ||
'sd-grid', | ||
this.props.className, | ||
'ui', | ||
{padded: this.props.padded}, | ||
{'equal width': this.props.stretched}, | ||
{divided: this.props.divided}, | ||
this.props.className, | ||
'grid', | ||
); | ||
return ( | ||
<div className={classes} style={this.props.style}> | ||
<div {...this.props} className={classes}> | ||
{this.props.children} | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
export default Grid; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
import classNames from 'classnames'; | ||
import React, {Component, PropTypes} from 'react'; | ||
|
||
class Row extends Component { | ||
export default class Row extends Component { | ||
static propTypes = { | ||
children: PropTypes.node, | ||
className: PropTypes.string, | ||
stretched: PropTypes.bool, | ||
style: PropTypes.object, | ||
}; | ||
|
||
render() { | ||
let classes = classNames('sd-row', this.props.className, {stretched: this.props.stretched}, 'row'); | ||
let classes = classNames( | ||
'sd-row', | ||
this.props.className, | ||
'row' | ||
); | ||
return ( | ||
<div className={classes} style={this.props.style}> | ||
<div {...this.props} className={classes}> | ||
{this.props.children} | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
export default Row; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inline export