1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-26 13:26:40 +07:00

added updated nodes to flow

This commit is contained in:
Fedor Katurov 2019-10-30 17:26:30 +07:00
parent 6f76bec2c0
commit 74cd181530
13 changed files with 128 additions and 30 deletions

View file

@ -1,19 +1,45 @@
import React, { FC } from 'react';
import * as styles from './styles.scss';
import { IFlowState } from '~/redux/flow/reducer';
import { getURL } from '~/utils/dom';
import { Link } from 'react-router-dom';
import { URLS } from '~/constants/urls';
import classNames from 'classnames';
interface IProps {
recent: IFlowState['recent'];
updated: IFlowState['updated'];
}
const FlowRecent: FC<IProps> = ({ recent }) => (
const FlowRecent: FC<IProps> = ({ recent, updated }) => (
<div className={styles.grid}>
{updated &&
updated.slice(0, 20).map(node => (
<Link key={node.id} className={styles.item} to={URLS.NODE_URL(node.id)}>
<div
className={classNames(styles.thumb, styles.new)}
style={{ backgroundImage: `url("${getURL({ url: node.thumbnail })}")` }}
/>
<div className={styles.info}>
<div className={styles.title}>{node.title}</div>
<div className={styles.comment}>{node.created_at}</div>
</div>
</Link>
))}
{recent &&
recent.slice(0, 9).map(node => (
<div key={node.id} className={styles.item}>
<div className={styles.thumb} />
<div className={styles.info}>{node.title}</div>
</div>
recent.slice(0, 20).map(node => (
<Link key={node.id} className={styles.item} to={URLS.NODE_URL(node.id)}>
<div
className={styles.thumb}
style={{ backgroundImage: `url("${getURL({ url: node.thumbnail })}")` }}
/>
<div className={styles.info}>
<div className={styles.title}>{node.title}</div>
<div className={styles.comment}>{node.created_at}</div>
</div>
</Link>
))}
</div>
);