mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 04:46:40 +07:00
closing sidebar on click
This commit is contained in:
parent
237f978cbd
commit
2e0ad878a3
3 changed files with 9 additions and 7 deletions
|
@ -1,4 +1,4 @@
|
||||||
import React, { FC } from 'react';
|
import React, { FC, MouseEventHandler } from 'react';
|
||||||
import { INode } from '~/types';
|
import { INode } from '~/types';
|
||||||
import styles from './styles.module.scss';
|
import styles from './styles.module.scss';
|
||||||
import { URLS } from '~/constants/urls';
|
import { URLS } from '~/constants/urls';
|
||||||
|
@ -11,11 +11,12 @@ import { Anchor } from '~/components/common/Anchor';
|
||||||
interface IProps {
|
interface IProps {
|
||||||
node: Partial<INode>;
|
node: Partial<INode>;
|
||||||
has_new?: boolean;
|
has_new?: boolean;
|
||||||
|
onClick?: MouseEventHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
const FlowRecentItem: FC<IProps> = ({ node, has_new }) => {
|
const FlowRecentItem: FC<IProps> = ({ node, has_new, onClick }) => {
|
||||||
return (
|
return (
|
||||||
<Anchor key={node.id} className={styles.item} href={URLS.NODE_URL(node.id)}>
|
<Anchor key={node.id} className={styles.item} href={URLS.NODE_URL(node.id)} onClick={onClick}>
|
||||||
<div
|
<div
|
||||||
className={classNames(styles.thumb, {
|
className={classNames(styles.thumb, {
|
||||||
[styles.new]: has_new,
|
[styles.new]: has_new,
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
import React, { FC } from 'react';
|
import React, { FC, MouseEventHandler } from 'react';
|
||||||
import { INode } from '~/types';
|
import { INode } from '~/types';
|
||||||
import styles from './styles.module.scss';
|
import styles from './styles.module.scss';
|
||||||
import { FlowRecentItem } from '~/components/flow/FlowRecentItem';
|
import { FlowRecentItem } from '~/components/flow/FlowRecentItem';
|
||||||
|
|
||||||
interface IProps {
|
interface IProps {
|
||||||
nodes: INode[];
|
nodes: INode[];
|
||||||
|
onClick?: MouseEventHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
const TagSidebarList: FC<IProps> = ({ nodes }) => (
|
const TagSidebarList: FC<IProps> = ({ nodes, onClick }) => (
|
||||||
<div className={styles.list}>
|
<div className={styles.list}>
|
||||||
{nodes.map(node => (
|
{nodes.map(node => (
|
||||||
<FlowRecentItem node={node} key={node.id} />
|
<FlowRecentItem node={node} key={node.id} onClick={onClick} />
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
@ -53,7 +53,7 @@ const TagSidebar: VFC<TagSidebarProps> = ({ tag, onRequestClose }) => {
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<InfiniteScroll hasMore={hasMore} loadMore={loadMore} className={styles.list}>
|
<InfiniteScroll hasMore={hasMore} loadMore={loadMore} className={styles.list}>
|
||||||
<TagSidebarList nodes={nodes} />
|
<TagSidebarList nodes={nodes} onClick={onRequestClose} />
|
||||||
</InfiniteScroll>
|
</InfiniteScroll>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue