Skip to content

Commit 20dc8c9

Browse files
committed
avoid negative margin
1 parent 45b0ff0 commit 20dc8c9

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

packages/bento-design-system/src/Layout/Column.css.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,15 @@ import { Breakpoint, breakpoints } from "../util/breakpoints";
44

55
export const columnsSpace = createVar("columns-space");
66

7-
export const columns = style({
8-
marginLeft: `calc(${columnsSpace} * -1)`,
9-
});
7+
export const column = style({});
108

119
export const columnContent = style({
1210
marginLeft: columnsSpace,
11+
selectors: {
12+
[`${column}:first-child &`]: {
13+
marginLeft: 0,
14+
},
15+
},
1316
});
1417

1518
const styleForScale = (scale: number): StyleRule => ({

packages/bento-design-system/src/Layout/Columns.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
mobileWidths,
1717
fullWidth,
1818
columnsSpace,
19-
columns,
19+
column,
2020
columnContent,
2121
} from "./Column.css";
2222
import { assignInlineVars } from "@vanilla-extract/dynamic";
@@ -36,8 +36,9 @@ export function Column({ children, width, sticky }: ColumnProps) {
3636

3737
const className =
3838
width == null
39-
? fullWidth
39+
? [column, fullWidth]
4040
: [
41+
column,
4142
wide && wideWidths[wide],
4243
desktop && desktopWidths[desktop],
4344
tablet && tabletWidths[tablet],
@@ -64,7 +65,6 @@ export function Columns({ space, children, align, alignY, collapseBelow, reverse
6465
display="flex"
6566
{...responsiveCollapsibleAlignmentProps({ align, alignY, collapseBelow, reverse })}
6667
style={assignInlineVars({ [columnsSpace]: `${space}px` })}
67-
className={columns}
6868
>
6969
{flattenChildren(children).map((child, index) => {
7070
if (isColumn(child)) {

0 commit comments

Comments
 (0)