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

feat(grid): add column padding helper class #5449

Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ em {
padding-top: 0.0625rem;
padding-bottom: 0.0625rem; }

.bx--col-padding {
padding-top: 1rem;
padding-bottom: 1rem; }

.bx--col {
width: 100%;
padding-right: 1rem;
Expand Down
33 changes: 33 additions & 0 deletions packages/grid/examples/preview/src/components/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,39 @@ const sections = [
</div>
),
},
{
name: 'Include column padding',
description:
'Use the column padding helper to add vertical padding to a node in a column',
content() {
return (
<div className="bx--grid">
<div className="bx--row">
<div className="bx--col bx--col-padding">
<div className="outside">
<div className="inside">1/4</div>
</div>
</div>
<div className="bx--col">
<div className="outside bx--col-padding">
<div className="inside">1/4</div>
</div>
</div>
<div className="bx--col bx--col-padding">
<div className="outside">
<div className="inside">1/4</div>
</div>
</div>
<div className="bx--col bx--col-padding">
<div className="outside">
<div className="inside">1/4</div>
</div>
</div>
</div>
</div>
);
},
},
],
},
{
Expand Down
2 changes: 1 addition & 1 deletion packages/grid/examples/preview/styles.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import '../../scss/grid';
@import '../../scss/index';

*,
*::before,
Expand Down
5 changes: 5 additions & 0 deletions packages/grid/scss/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,11 @@ $carbon--aspect-ratios: ((16, 9), (2, 1), (4, 3), (1, 1), (1, 2));
padding-bottom: $condensed-gutter / 2;
}

.#{$prefix}--col-padding {
padding-top: $grid-gutter / 2;
padding-bottom: $grid-gutter / 2;
}

@include carbon--make-grid-columns($breakpoints, $grid-gutter);
@include carbon--no-gutter();
@include carbon--hang($grid-gutter);
Expand Down