Skip to content

Commit

Permalink
avoid negative margin
Browse files Browse the repository at this point in the history
  • Loading branch information
veej committed Mar 29, 2024
1 parent 45b0ff0 commit 20dc8c9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
9 changes: 6 additions & 3 deletions packages/bento-design-system/src/Layout/Column.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@ import { Breakpoint, breakpoints } from "../util/breakpoints";

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

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

export const columnContent = style({
marginLeft: columnsSpace,
selectors: {
[`${column}:first-child &`]: {
marginLeft: 0,
},
},
});

const styleForScale = (scale: number): StyleRule => ({
Expand Down
6 changes: 3 additions & 3 deletions packages/bento-design-system/src/Layout/Columns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
mobileWidths,
fullWidth,
columnsSpace,
columns,
column,
columnContent,
} from "./Column.css";
import { assignInlineVars } from "@vanilla-extract/dynamic";
Expand All @@ -36,8 +36,9 @@ export function Column({ children, width, sticky }: ColumnProps) {

const className =
width == null
? fullWidth
? [column, fullWidth]
: [
column,
wide && wideWidths[wide],
desktop && desktopWidths[desktop],
tablet && tabletWidths[tablet],
Expand All @@ -64,7 +65,6 @@ export function Columns({ space, children, align, alignY, collapseBelow, reverse
display="flex"
{...responsiveCollapsibleAlignmentProps({ align, alignY, collapseBelow, reverse })}
style={assignInlineVars({ [columnsSpace]: `${space}px` })}
className={columns}
>
{flattenChildren(children).map((child, index) => {
if (isColumn(child)) {
Expand Down

0 comments on commit 20dc8c9

Please sign in to comment.