Skip to content

Commit b8866a9

Browse files
committed
fix: better css variable naming
1 parent 340ab9d commit b8866a9

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

packages/modules/data-widgets/src/themesource/datawidgets/web/_datagrid.scss

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -537,17 +537,17 @@ $root: ".widget-datagrid";
537537

538538
.infinite-loading {
539539
.widget-datagrid-grid-head {
540-
width: calc(var(--mx-grid-width) - var(--mx-grid-scrollbar-size));
540+
width: calc(var(--widgets-grid-width) - var(--widgets-grid-scrollbar-size));
541541
overflow-x: hidden;
542542
}
543543
.widget-datagrid-grid-head[data-scrolled-y="true"] {
544544
box-shadow: 0 5px 5px -5px gray;
545545
}
546546

547547
.widget-datagrid-grid-body {
548-
width: var(--mx-grid-width);
548+
width: var(--widgets-grid-width);
549549
overflow-y: auto;
550-
max-height: var(--mx-grid-body-height);
550+
max-height: var(--widgets-grid-body-height);
551551
}
552552

553553
.widget-datagrid-grid-head[data-scrolled-x="true"]:after {
@@ -564,22 +564,22 @@ $root: ".widget-datagrid";
564564
.widget-datagrid-grid-head {
565565
display: grid;
566566

567-
// this head is not part of the grid, so it has dedicated column template --mx-grid-template-columns-head
568-
// but it might not be available at the initial render, so we use template from the grid --mx-grid-template-columns
567+
// this head is not part of the grid, so it has dedicated column template --widgets-grid-template-columns-head
568+
// but it might not be available at the initial render, so we use template from the grid --widgets-grid-template-columns
569569
// using template from the grid might to misalignment from the grid itself,
570570
// but in practice:
571571
// - grid has no data at that moment, so misalignment is not visible.
572-
// - as soon as the grid itself gets rendered --mx-grid-template-columns-head gets calculated
572+
// - as soon as the grid itself gets rendered --widgets-grid-template-columns-head gets calculated
573573
// and everything looks like it should.
574-
grid-template-columns: var(--mx-grid-template-columns-head, var(--mx-grid-template-columns));
574+
grid-template-columns: var(--widgets-grid-template-columns-head, var(--widgets-grid-template-columns));
575575
}
576576
.widget-datagrid-grid-body {
577577
// this element has to position their children (columns or headers)
578578
// as grid and have those aligned with the parent grid
579579
display: grid;
580580
// this property makes sure we align our own grid columns
581581
// to the columns defined in the global grid
582-
grid-template-columns: var(--mx-grid-template-columns);
582+
grid-template-columns: var(--widgets-grid-template-columns);
583583
}
584584

585585
.grid-mock-header {

packages/pluggableWidgets/datagrid-web/src/components/__tests__/__snapshots__/Grid.spec.tsx.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ exports[`Grid renders without crashing 1`] = `
55
<div
66
class="widget-datagrid-grid table"
77
role="grid"
8-
style="--mx-grid-template-columns: 1fr 1fr 54px;"
8+
style="--widgets-grid-template-columns: 1fr 1fr 54px;"
99
>
1010
Test
1111
</div>
@@ -17,7 +17,7 @@ exports[`Grid renders without selector column 1`] = `
1717
<div
1818
class="widget-datagrid-grid table"
1919
role="grid"
20-
style="--mx-grid-template-columns: 1fr 1fr;"
20+
style="--widgets-grid-template-columns: 1fr 1fr;"
2121
>
2222
Test
2323
</div>

packages/pluggableWidgets/datagrid-web/src/model/models/grid.model.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ export function gridStyleAtom(
1616
return computed(
1717
() =>
1818
({
19-
"--mx-grid-template-columns": templateColumns(columns.visibleColumns, {
19+
"--widgets-grid-template-columns": templateColumns(columns.visibleColumns, {
2020
checkboxColumn: config.checkboxColumnEnabled,
2121
selectorColumn: config.selectorColumnEnabled
2222
}),
23-
"--mx-grid-template-columns-head": gridSizeStore.templateColumnsHead,
24-
"--mx-grid-body-height": asPx(gridSizeStore.gridBodyHeight),
25-
"--mx-grid-width": asPx(gridSizeStore.gridWidth),
26-
"--mx-grid-scrollbar-size": asPx(gridSizeStore.scrollBarSize)
23+
"--widgets-grid-template-columns-head": gridSizeStore.templateColumnsHead,
24+
"--widgets-grid-body-height": asPx(gridSizeStore.gridBodyHeight),
25+
"--widgets-grid-width": asPx(gridSizeStore.gridWidth),
26+
"--widgets-grid-scrollbar-size": asPx(gridSizeStore.scrollBarSize)
2727
}) as CSSProperties
2828
);
2929
}

0 commit comments

Comments
 (0)