Skip to content

Commit

Permalink
fix(Grid): [BLA-1199] Consider only the direct children of the row wh…
Browse files Browse the repository at this point in the history
…ile calculating span
  • Loading branch information
vishwapriya committed Feb 21, 2025
1 parent daa0d9a commit 63c952e
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 1 deletion.
14 changes: 14 additions & 0 deletions packages/core-components/src/components/grid/grid.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,17 @@
margin: 0 auto;
box-sizing: border-box;
}

:host(.b2b-grid-row) {
display: flex;
flex-wrap: wrap;
}

:host(.b2b-grid-col) {
display: flex;
flex-direction: column;
}

.b2b-grid-col > .b2b-grid-row {
flex: 1;
}
2 changes: 1 addition & 1 deletion packages/core-components/src/components/grid/row.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class B2bGridRowComponent {
}

private adjustColumnFlex() {
const columns = this.hostElement.querySelectorAll('b2b-grid-col');
const columns = this.hostElement.querySelectorAll(':scope > b2b-grid-col');
let totalSpan = 0;
let columnsWithoutSpan: HTMLElement[] = [];

Expand Down
6 changes: 6 additions & 0 deletions packages/core-components/src/html/dev-styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ h1 {
height: 200px;
}

.grid-test-box--blue {
border: 1px solid black;
background-color: #78ace0;
height: 100%;
}

.grid-test-box--small {
border: 1px solid black;
padding: 0.75rem;
Expand Down
18 changes: 18 additions & 0 deletions packages/core-components/src/html/utilities.html
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,24 @@ <h1>Grid Component</h1>
></b2b-grid-col>
<b2b-grid-col><div class="grid-test-box"></div></b2b-grid-col>
</b2b-grid-row>
<b2b-grid-row>
<b2b-grid-col>
<b2b-grid-row>
<b2b-grid-col
><div class="grid-test-box--blue"></div
></b2b-grid-col>
<b2b-grid-col><div class="grid-test-box"></div></b2b-grid-col>
</b2b-grid-row>
</b2b-grid-col>
<b2b-grid-col>
<b2b-grid-row>
<b2b-grid-col
><div class="grid-test-box--blue"></div
></b2b-grid-col>
<b2b-grid-col><div class="grid-test-box"></div></b2b-grid-col>
</b2b-grid-row>
</b2b-grid-col>
</b2b-grid-row>
</b2b-grid>
</div>
<b2b-background-box fixed-width="true" no-padding="false">
Expand Down

0 comments on commit 63c952e

Please sign in to comment.