1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 12:56:41 +07:00

refactored comment form

This commit is contained in:
Fedor Katurov 2020-11-09 17:55:00 +07:00
parent af9b206a78
commit 9db25afb28
19 changed files with 235 additions and 153 deletions

View file

@ -25,14 +25,14 @@ type Props = ReturnType<typeof mapStateToProps> &
typeof mapDispatchToProps & {
file: IFile;
isEditing?: boolean;
onDrop?: (id: IFile['id']) => void;
onDelete?: (id: IFile['id']) => void;
onTitleChange?: (file_id: IFile['id'], title: IFile['metadata']['title']) => void;
};
const AudioPlayerUnconnected = memo(
({
file,
onDrop,
onDelete,
isEditing,
onTitleChange,
player: { file: current, status },
@ -78,10 +78,10 @@ const AudioPlayerUnconnected = memo(
);
const onDropClick = useCallback(() => {
if (!onDrop) return;
if (!onDelete) return;
onDrop(file.id);
}, [file, onDrop]);
onDelete(file.id);
}, [file, onDelete]);
const title = useMemo(
() =>
@ -111,7 +111,7 @@ const AudioPlayerUnconnected = memo(
return (
<div onClick={onPlay} className={classNames(styles.wrap, { playing })}>
{onDrop && (
{onDelete && (
<div className={styles.drop} onMouseDown={onDropClick}>
<Icon icon="close" />
</div>
@ -149,7 +149,4 @@ const AudioPlayerUnconnected = memo(
}
);
export const AudioPlayer = connect(
mapStateToProps,
mapDispatchToProps
)(AudioPlayerUnconnected);
export const AudioPlayer = connect(mapStateToProps, mapDispatchToProps)(AudioPlayerUnconnected);