1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 12:56:41 +07:00

returned fluid lab

This commit is contained in:
Fedor Katurov 2021-09-28 17:16:35 +07:00
parent 8ff18dfd10
commit 2e4cb24cf4
4 changed files with 41 additions and 37 deletions

View file

@ -1,4 +1,5 @@
import React, { FC } from 'react';
import Masonry from 'react-masonry-css';
import { useShallowSelect } from '~/utils/hooks/useShallowSelect';
import styles from './styles.module.scss';
import { LabNode } from '~/components/lab/LabNode';
@ -8,6 +9,11 @@ import { values } from 'ramda';
interface IProps {}
const breakpointCols = {
default: 2,
1280: 1,
};
const getRandomNodeType = () =>
values(NODE_TYPES)[Math.floor(Math.random() * values(NODE_TYPES).length)];
@ -26,17 +32,30 @@ const LabGrid: FC<IProps> = () => {
if (is_loading) {
return (
<div className={styles.wrap}>
<Masonry
className={styles.wrap}
breakpointCols={breakpointCols}
columnClassName={styles.column}
>
<LoadingNode />
<LoadingNode />
<LoadingNode />
<LoadingNode />
</div>
<LoadingNode />
<LoadingNode />
<LoadingNode />
<LoadingNode />
<LoadingNode />
</Masonry>
);
}
return (
<div className={styles.wrap}>
<Masonry
className={styles.wrap}
breakpointCols={breakpointCols}
columnClassName={styles.column}
>
{nodes.map(node => (
<LabNode
node={node.node}
@ -45,7 +64,7 @@ const LabGrid: FC<IProps> = () => {
commentCount={node.comment_count}
/>
))}
</div>
</Masonry>
);
};

View file

@ -1,8 +1,17 @@
@import "~/styles/variables.scss";
.wrap {
display: grid;
grid-auto-flow: row;
grid-auto-rows: auto;
grid-row-gap: $gap * 2;
div.wrap {
display: flex;
width: 100%;
margin-right: 0;
}
.column {
background-clip: padding-box;
box-sizing: border-box;
padding: 0 $gap / 2;
& > div {
margin-bottom: $gap;
}
}