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

Classes & Props: Container/Grid/Row/Column #34

Merged
merged 4 commits into from
Oct 8, 2015
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
10 changes: 4 additions & 6 deletions src/components/Container/Container.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import classNames from 'classnames';
* </Container>
*/

class Container extends Component {
export default class Container extends Component {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inline export

static propTypes = {
children: PropTypes.node,
className: PropTypes.string,
Expand All @@ -21,16 +21,14 @@ class Container extends Component {
render() {
let classes = classNames(
'sd-container',
this.props.className,
'ui',
'container'
this.props.className,
'container',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

insert className between ui and the component name class.

);
return (
<div className={classes}>
<div {...this.props} className={classes}>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spread props

{this.props.children}
</div>
);
}
}

export default Container;
7 changes: 3 additions & 4 deletions src/components/Grid/Column.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inline export

static propTypes = {
children: PropTypes.node,
className: PropTypes.string,
Expand All @@ -13,15 +13,14 @@ class Column extends Component {
render() {
let classes = classNames(
'sd-column',
this.props.className,
Copy link
Member Author

Choose a reason for hiding this comment

The 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}>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spread props

{this.props.children}
</div>
);
}
}

export default Column;
15 changes: 3 additions & 12 deletions src/components/Grid/Grid.js
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;
14 changes: 7 additions & 7 deletions src/components/Grid/Row.js
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;