Skip to content

Commit

Permalink
Implement Masonry using flexbox
Browse files Browse the repository at this point in the history
  • Loading branch information
hbjORbj committed Aug 30, 2021
1 parent 7e7f40f commit ab6c06e
Show file tree
Hide file tree
Showing 48 changed files with 261 additions and 1,081 deletions.
23 changes: 0 additions & 23 deletions docs/pages/api-docs/masonry-item.js

This file was deleted.

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

This file was deleted.

26 changes: 13 additions & 13 deletions docs/src/pages/components/masonry/BasicMasonry.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
import * as React from 'react';
import Box from '@material-ui/core/Box';
import { styled } from '@material-ui/core/styles';
import Paper from '@material-ui/core/Paper';
import Masonry from '@material-ui/lab/Masonry';
import MasonryItem from '@material-ui/lab/MasonryItem';

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

const Item = styled(Paper)(({ theme }) => ({
...theme.typography.body2,
color: theme.palette.text.secondary,
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
}));

export default function BasicMasonry() {
return (
<Box sx={{ width: 500, minHeight: 393 }}>
<Masonry columns={4} spacing={1}>
{heights.map((height, index) => (
<MasonryItem key={index}>
<Box
sx={{
textAlign: 'center',
height,
border: 1,
bgcolor: 'background.paper',
}}
>
{index + 1}
</Box>
</MasonryItem>
<Item key={index} sx={{ height }}>
{index + 1}
</Item>
))}
</Masonry>
</Box>
Expand Down
26 changes: 13 additions & 13 deletions docs/src/pages/components/masonry/BasicMasonry.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
import * as React from 'react';
import Box from '@material-ui/core/Box';
import { styled } from '@material-ui/core/styles';
import Paper from '@material-ui/core/Paper';
import Masonry from '@material-ui/lab/Masonry';
import MasonryItem from '@material-ui/lab/MasonryItem';

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

const Item = styled(Paper)(({ theme }) => ({
...theme.typography.body2,
color: theme.palette.text.secondary,
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
}));

export default function BasicMasonry() {
return (
<Box sx={{ width: 500, minHeight: 393 }}>
<Masonry columns={4} spacing={1}>
{heights.map((height, index) => (
<MasonryItem key={index}>
<Box
sx={{
textAlign: 'center',
height,
border: 1,
bgcolor: 'background.paper',
}}
>
{index + 1}
</Box>
</MasonryItem>
<Item key={index} sx={{ height }}>
{index + 1}
</Item>
))}
</Masonry>
</Box>
Expand Down
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.

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.

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

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

const Item = styled(Paper)(({ theme }) => ({
...theme.typography.body2,
color: theme.palette.text.secondary,
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
}));

export default function FixedColumns() {
return (
<Box sx={{ width: 500, minHeight: 253 }}>
<Masonry columns={4} spacing={1}>
{heights.map((height, index) => (
<MasonryItem key={index}>
<Box
sx={{
textAlign: 'center',
height,
border: 1,
bgcolor: 'background.paper',
}}
>
{index + 1}
</Box>
</MasonryItem>
<Item key={index} sx={{ height }}>
{index + 1}
</Item>
))}
</Masonry>
</Box>
Expand Down
26 changes: 13 additions & 13 deletions docs/src/pages/components/masonry/FixedColumns.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
import * as React from 'react';
import Box from '@material-ui/core/Box';
import { styled } from '@material-ui/core/styles';
import Paper from '@material-ui/core/Paper';
import Masonry from '@material-ui/lab/Masonry';
import MasonryItem from '@material-ui/lab/MasonryItem';

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

const Item = styled(Paper)(({ theme }) => ({
...theme.typography.body2,
color: theme.palette.text.secondary,
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
}));

export default function FixedColumns() {
return (
<Box sx={{ width: 500, minHeight: 253 }}>
<Masonry columns={4} spacing={1}>
{heights.map((height, index) => (
<MasonryItem key={index}>
<Box
sx={{
textAlign: 'center',
height,
border: 1,
bgcolor: 'background.paper',
}}
>
{index + 1}
</Box>
</MasonryItem>
<Item key={index} sx={{ height }}>
{index + 1}
</Item>
))}
</Masonry>
</Box>
Expand Down
Loading

0 comments on commit ab6c06e

Please sign in to comment.