1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-24 20:36:40 +07:00
vault-frontend/src/components/flow/FlowCellMenu/index.tsx
2021-10-13 16:14:37 +07:00

70 lines
2 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import React, { FC } from 'react';
import styles from './styles.module.scss';
import { Icon } from '~/components/input/Icon';
import classNames from 'classnames';
import { Toggle } from '~/components/input/Toggle';
import { Group } from '~/components/containers/Group';
import { FlowDisplayVariant } from '~/redux/types';
interface Props {
onClose: () => void;
currentView: FlowDisplayVariant;
descriptionEnabled: boolean;
hasDescription: boolean;
toggleViewDescription: () => void;
setViewSingle: () => void;
setViewHorizontal: () => void;
setViewVertical: () => void;
setViewQuadro: () => void;
}
const FlowCellMenu: FC<Props> = ({
onClose,
hasDescription,
toggleViewDescription,
descriptionEnabled,
setViewSingle,
setViewHorizontal,
setViewVertical,
setViewQuadro,
}) => {
return (
<div className={classNames(styles.dropdown)}>
{onClose && (
<button className={styles.close} onClick={onClose} type="button">
<Icon icon="close" size={24} />
</button>
)}
<div className={styles.menu}>
<div className={styles.display}>
<Icon icon="cell-single" onMouseDown={setViewSingle} size={48} />
<Icon
icon={descriptionEnabled ? 'cell-double-h-text' : 'cell-double-h'}
onMouseDown={setViewHorizontal}
size={48}
/>
<Icon
icon={descriptionEnabled ? 'cell-double-v-text' : 'cell-double-v'}
onMouseDown={setViewVertical}
size={48}
/>
<Icon
icon={descriptionEnabled ? 'cell-quadro-text' : 'cell-quadro'}
onMouseDown={setViewQuadro}
size={48}
/>
</div>
{hasDescription && (
<Group className={styles.description} horizontal onClick={toggleViewDescription}>
<Toggle color="white" value={descriptionEnabled} />
<span>Текст</span>
</Group>
)}
</div>
</div>
);
};
export { FlowCellMenu };