mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 04:46:40 +07:00
remove bars components
This commit is contained in:
parent
92efb1e97e
commit
8ec77986bf
7 changed files with 13 additions and 3 deletions
|
@ -0,0 +1,58 @@
|
|||
import React, { FC, useCallback, useState } from 'react';
|
||||
|
||||
import classNames from 'classnames';
|
||||
|
||||
import { Icon } from '~/components/input/Icon';
|
||||
import { Dialog } from '~/constants/modal';
|
||||
import { useShowModal } from '~/hooks/modal/useShowModal';
|
||||
|
||||
import styles from './styles.module.scss';
|
||||
|
||||
export interface SubmitBarProps {
|
||||
isLab?: boolean;
|
||||
}
|
||||
|
||||
const SubmitBar: FC<SubmitBarProps> = ({ isLab }) => {
|
||||
const showModal = useShowModal(Dialog.CreateNode);
|
||||
const [focused, setFocused] = useState(false);
|
||||
|
||||
const onFocus = useCallback(() => setFocused(true), [setFocused]);
|
||||
const onBlur = useCallback(() => setFocused(false), [setFocused]);
|
||||
|
||||
const createUrl = useCallback(
|
||||
(type: string) => () => {
|
||||
showModal({ type, isInLab: !!isLab });
|
||||
},
|
||||
[isLab, showModal]
|
||||
);
|
||||
|
||||
const icon = isLab ? 'lab' : 'plus';
|
||||
|
||||
return (
|
||||
<div className={classNames(styles.wrap, { [styles.lab]: isLab })}>
|
||||
<div className={classNames(styles.panel, { [styles.active]: focused })}>
|
||||
<button onClick={createUrl('image')} className={styles.link}>
|
||||
<Icon icon="image" size={32} />
|
||||
</button>
|
||||
|
||||
<button onClick={createUrl('text')} className={styles.link}>
|
||||
<Icon icon="text" size={32} />
|
||||
</button>
|
||||
|
||||
<button onClick={createUrl('video')} className={styles.link}>
|
||||
<Icon icon="video" size={32} />
|
||||
</button>
|
||||
|
||||
<button onClick={createUrl('audio')} className={styles.link}>
|
||||
<Icon icon="audio" size={32} />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<button className={styles.button} onFocus={onFocus} onBlur={onBlur} type="button">
|
||||
<Icon icon={icon} />
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export { SubmitBar };
|
Loading…
Add table
Add a link
Reference in a new issue