mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 12:56:41 +07:00
#23 added labs layout
This commit is contained in:
parent
8316b46efe
commit
18ec220a4e
14 changed files with 135 additions and 65 deletions
21
src/containers/lab/LabGrid/index.tsx
Normal file
21
src/containers/lab/LabGrid/index.tsx
Normal file
|
@ -0,0 +1,21 @@
|
|||
import React, { FC } from 'react';
|
||||
import { useShallowSelect } from '~/utils/hooks/useShallowSelect';
|
||||
import { selectFlowNodes } from '~/redux/flow/selectors';
|
||||
import styles from './styles.module.scss';
|
||||
import { LabNode } from '~/containers/lab/LabNode';
|
||||
|
||||
interface IProps {}
|
||||
|
||||
const LabGrid: FC<IProps> = () => {
|
||||
const nodes = useShallowSelect(selectFlowNodes);
|
||||
|
||||
return (
|
||||
<div className={styles.wrap}>
|
||||
{nodes.map(node => (
|
||||
<LabNode node={node} key={node.id} />
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export { LabGrid };
|
8
src/containers/lab/LabGrid/styles.module.scss
Normal file
8
src/containers/lab/LabGrid/styles.module.scss
Normal file
|
@ -0,0 +1,8 @@
|
|||
@import "~/styles/variables.scss";
|
||||
|
||||
.wrap {
|
||||
display: grid;
|
||||
grid-auto-flow: row;
|
||||
grid-auto-rows: auto;
|
||||
grid-row-gap: $gap;
|
||||
}
|
27
src/containers/lab/LabLayout/index.tsx
Normal file
27
src/containers/lab/LabLayout/index.tsx
Normal file
|
@ -0,0 +1,27 @@
|
|||
import React, { FC } from 'react';
|
||||
import styles from './styles.module.scss';
|
||||
import { Card } from '~/components/containers/Card';
|
||||
import { Sticky } from '~/components/containers/Sticky';
|
||||
import { Container } from '~/containers/main/Container';
|
||||
import { LabGrid } from '~/containers/lab/LabGrid';
|
||||
|
||||
interface IProps {}
|
||||
|
||||
const LabLayout: FC<IProps> = () => (
|
||||
<div>
|
||||
<Container>
|
||||
<div className={styles.wrap}>
|
||||
<div className={styles.content}>
|
||||
<LabGrid />
|
||||
</div>
|
||||
<div className={styles.panel}>
|
||||
<Sticky>
|
||||
<Card>Test</Card>
|
||||
</Sticky>
|
||||
</div>
|
||||
</div>
|
||||
</Container>
|
||||
</div>
|
||||
);
|
||||
|
||||
export { LabLayout };
|
11
src/containers/lab/LabLayout/styles.module.scss
Normal file
11
src/containers/lab/LabLayout/styles.module.scss
Normal file
|
@ -0,0 +1,11 @@
|
|||
@import "~/styles/variables.scss";
|
||||
|
||||
.wrap {
|
||||
display: grid;
|
||||
grid-template-columns: 3fr 1fr;
|
||||
column-gap: $gap;
|
||||
}
|
||||
|
||||
.panel {
|
||||
margin-top: -7px;
|
||||
}
|
34
src/containers/lab/LabNode/index.tsx
Normal file
34
src/containers/lab/LabNode/index.tsx
Normal file
|
@ -0,0 +1,34 @@
|
|||
import React, { FC } from 'react';
|
||||
import { INode } from '~/redux/types';
|
||||
import { NodePanelInner } from '~/components/node/NodePanelInner';
|
||||
import { useNodeBlocks } from '~/utils/hooks/node/useNodeBlocks';
|
||||
|
||||
interface IProps {
|
||||
node: INode;
|
||||
}
|
||||
|
||||
const LabNode: FC<IProps> = ({ node }) => {
|
||||
const { inline, block, head } = useNodeBlocks(node, false);
|
||||
|
||||
return (
|
||||
<div>
|
||||
<NodePanelInner
|
||||
node={node}
|
||||
canEdit
|
||||
canLike
|
||||
canStar
|
||||
isLoading={false}
|
||||
onEdit={console.log}
|
||||
onLike={console.log}
|
||||
onStar={console.log}
|
||||
onLock={console.log}
|
||||
/>
|
||||
|
||||
{inline}
|
||||
{block}
|
||||
{head}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export { LabNode };
|
|
@ -6,6 +6,7 @@ import { BorisLayout } from '~/containers/node/BorisLayout';
|
|||
import { ErrorNotFound } from '~/containers/pages/ErrorNotFound';
|
||||
import { ProfilePage } from '~/containers/profile/ProfilePage';
|
||||
import { Redirect, Route, Switch, useLocation } from 'react-router';
|
||||
import { LabLayout } from '~/containers/lab/LabLayout';
|
||||
|
||||
interface IProps {}
|
||||
|
||||
|
@ -15,6 +16,7 @@ const MainRouter: FC<IProps> = () => {
|
|||
return (
|
||||
<Switch location={location}>
|
||||
<Route exact path={URLS.BASE} component={FlowLayout} />
|
||||
<Route exact path={URLS.LAB} component={LabLayout} />
|
||||
<Route path={URLS.NODE_URL(':id')} component={NodeLayout} />
|
||||
<Route path={URLS.BORIS} component={BorisLayout} />
|
||||
<Route path={URLS.ERRORS.NOT_FOUND} component={ErrorNotFound} />
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue