Skip to content

Commit 9f558cf

Browse files
janhasseltay1orjoneskodiakhq[bot]
authored
fix(grid): make subgrid work with grid offset (#9803)
* fix(grid): make subgrid work with grid offset * docs(grid): fix storybook styles prefix Co-authored-by: Taylor Jones <taylor.jones826@gmail.com> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
1 parent 83f2658 commit 9f558cf

3 files changed

Lines changed: 15 additions & 27 deletions

File tree

packages/carbon-react/src/components/Grid/Grid.stories.scss

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,54 +2,54 @@
22
@use '@carbon/styles/scss/type' as *;
33

44
// Grid modes
5-
.bx--css-grid {
5+
.cds--css-grid {
66
background-color: $blue-20;
77
outline: 1px dashed $blue-40;
88
}
99

10-
.bx--css-grid p {
10+
.cds--css-grid p {
1111
@include type-style('code-02');
1212
}
1313

14-
.bx--css-grid p:first-of-type {
14+
.cds--css-grid p:first-of-type {
1515
//messing up progress indicator stories
1616
margin-top: 0;
1717
}
1818

19-
.bx--css-grid.bx--css-grid--narrow {
19+
.cds--css-grid.cds--css-grid--narrow {
2020
background-color: $teal-20;
2121
outline: 1px dashed $teal-40;
2222
}
2323

24-
.bx--css-grid.bx--css-grid--condensed {
24+
.cds--css-grid.cds--css-grid--condensed {
2525
background-color: $purple-20;
2626
outline: 1px dashed $purple-40;
2727
}
2828

2929
// Only use background for subgrid example, not other subgrids in "mixed modes" story or others
30-
.bx--subgrid.example {
30+
.cds--subgrid.example {
3131
background-color: $green-20;
3232
}
3333

3434
// Columns
35-
.bx--css-grid > [class*='col'],
36-
.bx--subgrid > [class*='col'] {
35+
.cds--css-grid > [class*='col'],
36+
.cds--subgrid > [class*='col'] {
3737
min-height: 80px;
3838
}
3939

40-
.bx--css-grid > [class*='col'] {
40+
.cds--css-grid > [class*='col'] {
4141
background: $blue-10;
4242
}
4343

44-
.bx--subgrid > [class*='col'] {
44+
.cds--subgrid > [class*='col'] {
4545
background: $green-10;
4646
outline: 1px dashed $green-30;
4747
}
4848

49-
.bx--css-grid.bx--css-grid--narrow > [class*='col'] {
49+
.cds--css-grid.cds--css-grid--narrow > [class*='col'] {
5050
background: $teal-10;
5151
}
5252

53-
.bx--css-grid.bx--css-grid--condensed > [class*='col'] {
53+
.cds--css-grid.cds--css-grid--condensed > [class*='col'] {
5454
background: $purple-10;
5555
}

packages/grid/scss/modules/_css-grid.scss

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -254,10 +254,6 @@
254254
.#{$prefix}--col-start-#{$i} {
255255
grid-column-start: $i;
256256
}
257-
258-
.#{$prefix}--col-end-#{$i} {
259-
grid-column-end: $i;
260-
}
261257
}
262258

263259
.#{$prefix}--col-start-auto {
@@ -272,17 +268,13 @@
272268
$columns: map.get($value, columns);
273269

274270
@include breakpoint($name) {
275-
// The `grid-column-end` and `grid-column-start` properties are *not* inclusive.
276-
// It starts/ends the column *at* the column, not *on* the column. We must
271+
// The `grid-column-start` property is *not* inclusive.
272+
// It starts the column *at* the column, not *on* the column. We must
277273
// ensure that there is one additional class available for each breakpoint.
278274
@for $i from 1 through $columns + 1 {
279275
.#{$prefix}--#{$name}\:col-start-#{$i} {
280276
grid-column-start: $i;
281277
}
282-
283-
.#{$prefix}--#{$name}\:col-end-#{$i} {
284-
grid-column-end: $i;
285-
}
286278
}
287279

288280
.#{$prefix}--#{$name}\:col-start-auto {

packages/react/src/components/Grid/Column.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,7 @@ function getClassNameForBreakpoints(breakpoints, prefix) {
150150
}
151151

152152
if (typeof span === 'number') {
153-
if (typeof offset === 'number' && offset > 0) {
154-
classNames.push(`${prefix}--${name}:col-end-${offset + span + 1}`);
155-
} else {
156-
classNames.push(`${prefix}--${name}:col-span-${span}`);
157-
}
153+
classNames.push(`${prefix}--${name}:col-span-${span}`);
158154
}
159155

160156
if (span === true) {

0 commit comments

Comments
 (0)