Skip to content

Commit

Permalink
[@mantine/core] Grid: Fix offset and order responsive props (mantined…
Browse files Browse the repository at this point in the history
  • Loading branch information
mdodell authored and nmay231 committed Aug 22, 2022
1 parent 863cb31 commit 898c5aa
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
20 changes: 11 additions & 9 deletions src/mantine-core/src/Grid/Col/Col.styles.ts
Expand Up @@ -50,15 +50,17 @@ function getBreakpointsStyles({
columns: number;
}) {
return MANTINE_SIZES.reduce((acc, size) => {
if (typeof sizes[size] === 'number') {
acc[`@media (min-width: ${theme.breakpoints[size] + 1}px)`] = {
order: orders[size],
flexBasis: getColumnWidth(sizes[size], columns),
flexShrink: 0,
maxWidth: grow ? 'unset' : getColumnWidth(sizes[size], columns),
marginLeft: getColumnOffset(offsets[size], columns),
};
}
acc[`@media (min-width: ${theme.breakpoints[size] + 1}px)`] = {
order: orders[size],
flexBasis: typeof sizes[size] === 'number' ? getColumnWidth(sizes[size], columns) : 'auto',
flexShrink: 0,
maxWidth: grow
? 'unset'
: typeof sizes[size] === 'number'
? getColumnWidth(sizes[size], columns)
: 'none',
marginLeft: getColumnOffset(offsets[size], columns),
};
return acc;
}, {});
}
Expand Down
6 changes: 3 additions & 3 deletions src/mantine-demos/src/demos/core/Grid/Grid.demo.order.tsx
Expand Up @@ -8,9 +8,9 @@ import { Grid } from '@mantine/core';
function Demo() {
return (
<Grid>
<Col span={3} order={2} orderSm={1} orderLg={3}>2</Col>
<Col span={3} order={3} orderSm={1} orderLg={2}>3</Col>
<Col span={3} order={1} orderSm={3} orderLg={1}>1</Col>
<Grid.Col span={3} order={2} orderSm={1} orderLg={3}>2</Grid.Col>
<Grid.Col span={3} order={3} orderSm={1} orderLg={2}>3</Grid.Col>
<Grid.Col span={3} order={1} orderSm={3} orderLg={1}>1</Grid.Col>
</Grid>
);
}
Expand Down

0 comments on commit 898c5aa

Please sign in to comment.