Skip to content

Commit

Permalink
Added span = 0
Browse files Browse the repository at this point in the history
  • Loading branch information
abraztsov committed Jun 7, 2018
1 parent 76a843f commit cece45e
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 11 deletions.
5 changes: 5 additions & 0 deletions example/App.js
Expand Up @@ -28,6 +28,11 @@ export default class App extends React.Component {
);
colCode += ` <Col span={${12 / colCount}} />\n`;
}
cols.push(
<Col md={{ span: 0 }}>
<div style={{ display: 'flex', 'justifyContent': 'center', 'alignItems': 'center', height: '150px', fontSize: '1.5em', 'color': '#FFF' }}>col-4</div>
</Col>
);
return (
<div>
<div style={{ marginBottom: 16 }}>
Expand Down
2 changes: 1 addition & 1 deletion src/Col.js
Expand Up @@ -18,7 +18,7 @@ function Col({ span, offset, className, children, prefix = 'rct-grid-col', order
}
delete others[size]; // To prevent a "Warning: Unknown props.."
sizeClasses = Object.assign({}, sizeClasses, {
[s[`${prefix}-${size}-${sizeParams.span}`]]: sizeParams.span,
[s[`${prefix}-${size}-${sizeParams.span}`]]: typeof sizeParams.span !== 'undefined',
[s[`${prefix}-${size}-offset-${sizeParams.offset}`]]: sizeParams.offset || sizeParams.offset === 0,
[s[`${prefix}-${size}-order-${sizeParams.order}`]]: sizeParams.order || sizeParams.order === 0
});
Expand Down
32 changes: 22 additions & 10 deletions src/style/mixins.scss
Expand Up @@ -41,16 +41,28 @@
}

@mixin create-grid-options($class) {
@for $i from 1 through $grid-columns {
.#{$prefix}-col#{$class}-#{$i} {
display: block;
width: percentage($i / $grid-columns);
}
.#{$prefix}-col#{$class}-offset-#{$i} {
margin-left: percentage($i / $grid-columns);
}
.#{$prefix}-col#{$class}-order-#{$i} {
order: $i;
@for $i from 0 through $grid-columns {
@if $i == 0 {
.#{$prefix}-col#{$class}-#{$i} {
display: none;
}
.#{$prefix}-col#{$class}-offset-#{$i} {
margin-left: 0;
}
.#{$prefix}-col#{$class}-order-#{$i} {
order: 0;
}
} @else {
.#{$prefix}-col#{$class}-#{$i} {
display: block;
width: percentage($i / $grid-columns);
}
.#{$prefix}-col#{$class}-offset-#{$i} {
margin-left: percentage($i / $grid-columns);
}
.#{$prefix}-col#{$class}-order-#{$i} {
order: $i;
}
}
}
}
Expand Down

0 comments on commit cece45e

Please sign in to comment.