Skip to content

Commit

Permalink
[Masonry] Implement Masonry using Flexbox (#28059)
Browse files Browse the repository at this point in the history
  • Loading branch information
hbjORbj authored Oct 20, 2021
1 parent 6de6838 commit 0ff9cb5
Show file tree
Hide file tree
Showing 48 changed files with 573 additions and 885 deletions.
23 changes: 0 additions & 23 deletions docs/pages/api-docs/masonry-item.js

This file was deleted.

18 changes: 0 additions & 18 deletions docs/pages/api-docs/masonry-item.json

This file was deleted.

3 changes: 3 additions & 0 deletions docs/pages/api-docs/masonry.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
"default": "4"
},
"component": { "type": { "name": "elementType" } },
"defaultColumns": { "type": { "name": "number" } },
"defaultHeight": { "type": { "name": "number" } },
"defaultSpacing": { "type": { "name": "number" } },
"spacing": {
"type": {
"name": "union",
Expand Down
9 changes: 4 additions & 5 deletions docs/src/pages/components/masonry/BasicMasonry.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import * as React from 'react';
import { styled } from '@mui/material/styles';
import Box from '@mui/material/Box';
import { styled } from '@mui/material/styles';
import Paper from '@mui/material/Paper';
import Masonry from '@mui/lab/Masonry';
import MasonryItem from '@mui/lab/MasonryItem';

const heights = [150, 30, 90, 70, 110, 150, 130, 80, 50, 90, 100, 150, 30, 50, 80];

Expand All @@ -20,9 +19,9 @@ export default function BasicMasonry() {
<Box sx={{ width: 500, minHeight: 393 }}>
<Masonry columns={4} spacing={1}>
{heights.map((height, index) => (
<MasonryItem key={index}>
<Item sx={{ height }}>{index + 1}</Item>
</MasonryItem>
<Item key={index} sx={{ height }}>
{index + 1}
</Item>
))}
</Masonry>
</Box>
Expand Down
9 changes: 4 additions & 5 deletions docs/src/pages/components/masonry/BasicMasonry.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import * as React from 'react';
import { styled } from '@mui/material/styles';
import Box from '@mui/material/Box';
import { styled } from '@mui/material/styles';
import Paper from '@mui/material/Paper';
import Masonry from '@mui/lab/Masonry';
import MasonryItem from '@mui/lab/MasonryItem';

const heights = [150, 30, 90, 70, 110, 150, 130, 80, 50, 90, 100, 150, 30, 50, 80];

Expand All @@ -20,9 +19,9 @@ export default function BasicMasonry() {
<Box sx={{ width: 500, minHeight: 393 }}>
<Masonry columns={4} spacing={1}>
{heights.map((height, index) => (
<MasonryItem key={index}>
<Item sx={{ height }}>{index + 1}</Item>
</MasonryItem>
<Item key={index} sx={{ height }}>
{index + 1}
</Item>
))}
</Masonry>
</Box>
Expand Down
6 changes: 3 additions & 3 deletions docs/src/pages/components/masonry/BasicMasonry.tsx.preview
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Masonry columns={4} spacing={1}>
{heights.map((height, index) => (
<MasonryItem key={index}>
<Item sx={{ height }}>{index + 1}</Item>
</MasonryItem>
<Item key={index} sx={{ height }}>
{index + 1}
</Item>
))}
</Masonry>
46 changes: 0 additions & 46 deletions docs/src/pages/components/masonry/DiffColSizeMasonry.js

This file was deleted.

46 changes: 0 additions & 46 deletions docs/src/pages/components/masonry/DiffColSizeMasonry.tsx

This file was deleted.

This file was deleted.

46 changes: 0 additions & 46 deletions docs/src/pages/components/masonry/DiffColSizeMasonryBroken.js

This file was deleted.

46 changes: 0 additions & 46 deletions docs/src/pages/components/masonry/DiffColSizeMasonryBroken.tsx

This file was deleted.

This file was deleted.

9 changes: 4 additions & 5 deletions docs/src/pages/components/masonry/FixedColumns.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import * as React from 'react';
import { styled } from '@mui/material/styles';
import Box from '@mui/material/Box';
import { styled } from '@mui/material/styles';
import Paper from '@mui/material/Paper';
import Masonry from '@mui/lab/Masonry';
import MasonryItem from '@mui/lab/MasonryItem';

const heights = [150, 30, 90, 70, 90, 100, 150, 30, 50, 80];

Expand All @@ -20,9 +19,9 @@ export default function FixedColumns() {
<Box sx={{ width: 500, minHeight: 253 }}>
<Masonry columns={4} spacing={1}>
{heights.map((height, index) => (
<MasonryItem key={index}>
<Item sx={{ height }}>{index + 1}</Item>
</MasonryItem>
<Item key={index} sx={{ height }}>
{index + 1}
</Item>
))}
</Masonry>
</Box>
Expand Down
9 changes: 4 additions & 5 deletions docs/src/pages/components/masonry/FixedColumns.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import * as React from 'react';
import { styled } from '@mui/material/styles';
import Box from '@mui/material/Box';
import { styled } from '@mui/material/styles';
import Paper from '@mui/material/Paper';
import Masonry from '@mui/lab/Masonry';
import MasonryItem from '@mui/lab/MasonryItem';

const heights = [150, 30, 90, 70, 90, 100, 150, 30, 50, 80];

Expand All @@ -20,9 +19,9 @@ export default function FixedColumns() {
<Box sx={{ width: 500, minHeight: 253 }}>
<Masonry columns={4} spacing={1}>
{heights.map((height, index) => (
<MasonryItem key={index}>
<Item sx={{ height }}>{index + 1}</Item>
</MasonryItem>
<Item key={index} sx={{ height }}>
{index + 1}
</Item>
))}
</Masonry>
</Box>
Expand Down
6 changes: 3 additions & 3 deletions docs/src/pages/components/masonry/FixedColumns.tsx.preview
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Masonry columns={4} spacing={1}>
{heights.map((height, index) => (
<MasonryItem key={index}>
<Item sx={{ height }}>{index + 1}</Item>
</MasonryItem>
<Item key={index} sx={{ height }}>
{index + 1}
</Item>
))}
</Masonry>
Loading

0 comments on commit 0ff9cb5

Please sign in to comment.