Skip to content

Commit

Permalink
[@mantine/core] Grid: Fix offset={0} not working (#2346)
Browse files Browse the repository at this point in the history
  • Loading branch information
rtivital committed Sep 24, 2022
1 parent e6aa524 commit b7ba5d5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/mantine-core/src/Grid/Col/Col.styles.ts
Expand Up @@ -57,7 +57,7 @@ const getColumnFlexGrow = (colSpan: ColSpan, grow: boolean) => {
};

const getColumnOffset = (offset: number, columns: number) =>
offset ? `${100 / (columns / offset)}%` : undefined;
offset === 0 ? 0 : offset ? `${100 / (columns / offset)}%` : undefined;

function getBreakpointsStyles({
sizes,
Expand Down
13 changes: 13 additions & 0 deletions src/mantine-core/src/Grid/Grid.story.tsx
Expand Up @@ -15,3 +15,16 @@ export function UnexpectedRowBreak() {
</Grid>
);
}

export function Offset0() {
return (
<Grid>
<Grid.Col sx={{ backgroundColor: 'pink' }} span={3} offset={2} offsetSm={0}>
Column 1
</Grid.Col>
<Grid.Col sx={{ backgroundColor: 'silver' }} span={7}>
Column 2
</Grid.Col>
</Grid>
);
}

0 comments on commit b7ba5d5

Please sign in to comment.