Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
200 changes: 200 additions & 0 deletions examples/src/examples/ExampleGrid.bs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

91 changes: 91 additions & 0 deletions examples/src/examples/ExampleGrid.res
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
open Mui

module Item = {
@react.component
let make = (~children) =>
<Paper
sx={Sx.array([
Sx.Array.obj({
p: Number(2.),
textAlign: Center,
color: TextSecondary,
}),
])}>
children
</Paper>
}

@react.component
let make = () => {
<Box sx={Sx.obj({flexGrow: Number(1.)})}>
<Typography variant=H6 gutterBottom=true> {"Basic Grid"->React.string} </Typography>
<Grid container=true spacing={Int(2)}>
<Grid item=true xs={Number(8)}>
<Item> {"xs=8"->React.string} </Item>
</Grid>
<Grid item=true xs={Number(4)}>
<Item> {"xs=4"->React.string} </Item>
</Grid>
<Grid item=true xs={Number(4)}>
<Item> {"xs=4"->React.string} </Item>
</Grid>
<Grid item=true xs={Number(8)}>
<Item> {"xs=8"->React.string} </Item>
</Grid>
</Grid>
<br />
<Typography variant=H6 gutterBottom=true> {"Responsive Grid"->React.string} </Typography>
<Grid container=true spacing={Int(2)}>
<Grid item=true xs={Number(6)} md={Number(8)}>
<Item> {"xs=6 md=8"->React.string} </Item>
</Grid>
<Grid item=true xs={Number(6)} md={Number(4)}>
<Item> {"xs=6 md=4"->React.string} </Item>
</Grid>
<Grid item=true xs={Number(6)} md={Number(4)}>
<Item> {"xs=6 md=4"->React.string} </Item>
</Grid>
<Grid item=true xs={Number(6)} md={Number(8)}>
<Item> {"xs=6 md=8"->React.string} </Item>
</Grid>
</Grid>
<br />
<Typography variant=H6 gutterBottom=true> {"Grid Direction Column"->React.string} </Typography>
<Grid container=true spacing={Int(2)} direction=Column>
<Grid item=true>
<Item> {"Column 1"->React.string} </Item>
</Grid>
<Grid item=true>
<Item> {"Column 2"->React.string} </Item>
</Grid>
</Grid>
<br />
<Typography variant=H6 gutterBottom=true> {"Alignment - Center"->React.string} </Typography>
<Grid
container=true
spacing={Int(2)}
justifyContent=Center
alignItems=Center
sx={Sx.obj({minHeight: String("100px")})}>
<Grid item=true>
<Item> {"Centered"->React.string} </Item>
</Grid>
</Grid>
<br />
<Typography variant=H6 gutterBottom=true>
{"Alignment - Space Between"->React.string}
</Typography>
<Grid
container=true
spacing={Int(2)}
justifyContent=SpaceBetween
sx={Sx.obj({minHeight: String("100px")})}>
<Grid item=true xs={Number(5)}>
<Item> {"Left"->React.string} </Item>
</Grid>
<Grid item=true xs={Number(5)}>
<Item> {"Right"->React.string} </Item>
</Grid>
</Grid>
</Box>
}
25 changes: 25 additions & 0 deletions examples/src/examples/Examples.bs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions examples/src/examples/Examples.res
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,19 @@ let make = () => <>
<Divider />
<br />
<br />
<Grid container=true alignItems=String("center")>
<Grid item=true md=Number(6)>
<Typography variant=H5> {"Grid"->React.string} </Typography>
</Grid>
<Grid item=true md=Number(6)>
<ExampleGrid />
</Grid>
</Grid>
<br />
<br />
<Divider />
<br />
<br />
<Grid container=true alignItems=String("center")>
<Grid item=true md=Number(6)>
<Typography variant=H5> {"Icons"->React.string} </Typography>
Expand Down
19 changes: 19 additions & 0 deletions packages/rescript-mui-material/src/types/System.res
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ module Value = {
| @as("background.default") BackgroundDefault
| @as("background.paper") BackgroundPaper

/* Flexbox and Grid Alignment */
| @as("normal") Normal
| @as("stretch") Stretch
| @as("center") Center
Expand All @@ -77,6 +78,22 @@ module Value = {
| @as("self-start") SelfStart
| @as("self-end") SelfEnd
| @as("baseline") Baseline
| @as("space-between") SpaceBetween
| @as("space-around") SpaceAround
| @as("space-evenly") SpaceEvenly
| @as("left") Left
| @as("right") Right

/* Flexbox direction */
| @as("row") Row
| @as("row-reverse") RowReverse
| @as("column") Column
| @as("column-reverse") ColumnReverse

/* Flexbox wrap */
| @as("nowrap") Nowrap
| @as("wrap") Wrap
| @as("wrap-reverse") WrapReverse

/* Overflow */
| @as("auto") Auto
Expand Down Expand Up @@ -140,6 +157,8 @@ type props = {
flexShrink?: Value.t,
flexWrap?: Value.t,
justifyContent?: Value.t,
justifyItems?: Value.t,
justifySelf?: Value.t,
order?: Value.t,
gap?: Value.t,
columnGap?: Value.t,
Expand Down