Skip to content

Commit

Permalink
[system] Add grid support
Browse files Browse the repository at this point in the history
Provides the foundations for mui#15878
  • Loading branch information
LavaToaster authored and oliviertassinari committed Feb 1, 2020
1 parent 39c8170 commit 05aaf80
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 0 deletions.
67 changes: 67 additions & 0 deletions packages/material-ui-system/src/grid.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import style from './style';
import compose from './compose';

export const gridGap = style({
prop: 'gridGap',
});

export const gridColumnGap = style({
prop: 'gridColumnGap',
});

export const gridRowGap = style({
prop: 'gridRowGap',
});

export const gridColumn = style({
prop: 'gridColumn',
});

export const gridRow = style({
prop: 'gridRow',
});

export const gridAutoFlow = style({
prop: 'gridAutoFlow',
});

export const gridAutoColumns = style({
prop: 'gridAutoColumns',
});

export const gridAutoRows = style({
prop: 'gridAutoRows',
});

export const gridTemplateColumns = style({
prop: 'gridTemplateColumns',
});

export const gridTemplateRows = style({
prop: 'gridTemplateRows',
});

export const gridTemplateAreas = style({
prop: 'gridTemplateAreas',
});

export const gridArea = style({
prop: 'gridArea',
});

const grid = compose(
gridGap,
gridColumnGap,
gridRowGap,
gridColumn,
gridRow,
gridAutoFlow,
gridAutoColumns,
gridAutoRows,
gridTemplateColumns,
gridTemplateRows,
gridTemplateAreas,
gridArea,
);

export default grid;
18 changes: 18 additions & 0 deletions packages/material-ui-system/src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export const display: SimpleStyleFunction<

export type DisplayProps = PropsFor<typeof display>;

// flexbox.js
export const flexbox: SimpleStyleFunction<
| 'flexBasis'
| 'flexDirection'
Expand All @@ -81,6 +82,23 @@ export const flexbox: SimpleStyleFunction<
>;
export type FlexboxProps = PropsFor<typeof flexbox>;

// grid.js
export const grid: SimpleStyleFunction<
| 'gridGap'
| 'gridColumnGap'
| 'gridRowGap'
| 'gridColumn'
| 'gridRow'
| 'gridAutoFlow'
| 'gridAutoColumns'
| 'gridAutoRows'
| 'gridTemplateColumns'
| 'gridTemplateRows'
| 'gridTemplateAreas'
| 'gridArea'
>;
export type GridProps = PropsFor<typeof grid>;

// palette.js
export const color: SimpleStyleFunction<'color'>;
export const bgcolor: SimpleStyleFunction<'bgcolor'>;
Expand Down
2 changes: 2 additions & 0 deletions packages/material-ui-system/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ export { default as css } from './css';
export { default as display } from './display';
export { default as flexbox } from './flexbox';
export * from './flexbox';
export { default as grid } from './grid';
export * from './grid';
export { default as palette } from './palette';
export * from './palette';
export { default as positions } from './positions';
Expand Down

0 comments on commit 05aaf80

Please sign in to comment.