mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-24 20:36:40 +07:00
fixed types
This commit is contained in:
parent
5d219b3196
commit
d9a56255c5
4 changed files with 30 additions and 13 deletions
|
@ -15,7 +15,9 @@ interface IProps {
|
||||||
onDrop: DragEventHandler<HTMLFormElement>;
|
onDrop: DragEventHandler<HTMLFormElement>;
|
||||||
}
|
}
|
||||||
|
|
||||||
const SortableItem = SortableElement(({ children }) => <div className={styles.item}>{children}</div>);
|
const SortableItem = SortableElement(({ children }) => (
|
||||||
|
<div className={styles.item}>{children}</div>
|
||||||
|
));
|
||||||
|
|
||||||
const SortableList = SortableContainer(
|
const SortableList = SortableContainer(
|
||||||
({
|
({
|
||||||
|
@ -23,10 +25,10 @@ const SortableList = SortableContainer(
|
||||||
locked,
|
locked,
|
||||||
onDrop
|
onDrop
|
||||||
}: {
|
}: {
|
||||||
items: IFile[];
|
items: IFile[];
|
||||||
locked: IUploadStatus[];
|
locked: IUploadStatus[];
|
||||||
onUpload: ChangeEventHandler<HTMLInputElement>;
|
onUpload: ChangeEventHandler<HTMLInputElement>;
|
||||||
onDrop: DragEventHandler<HTMLFormElement>;
|
onDrop: DragEventHandler<HTMLFormElement>;
|
||||||
}) => (
|
}) => (
|
||||||
<form className={styles.grid} onDrop={onDrop}>
|
<form className={styles.grid} onDrop={onDrop}>
|
||||||
{items.map((file, index) => (
|
{items.map((file, index) => (
|
||||||
|
@ -46,7 +48,9 @@ const SortableList = SortableContainer(
|
||||||
const ImageGrid: FC<IProps> = ({
|
const ImageGrid: FC<IProps> = ({
|
||||||
items, locked, onFileMove, onUpload, onDrop
|
items, locked, onFileMove, onUpload, onDrop
|
||||||
}) => {
|
}) => {
|
||||||
const onMove = useCallback(({ oldIndex, newIndex }) => onFileMove(oldIndex, newIndex), [onFileMove]);
|
const onMove = useCallback(({ oldIndex, newIndex }) => onFileMove(oldIndex, newIndex), [
|
||||||
|
onFileMove
|
||||||
|
]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SortableList
|
<SortableList
|
||||||
|
@ -57,6 +61,7 @@ const ImageGrid: FC<IProps> = ({
|
||||||
onUpload={onUpload}
|
onUpload={onUpload}
|
||||||
onDrop={onDrop}
|
onDrop={onDrop}
|
||||||
pressDelay={100}
|
pressDelay={100}
|
||||||
|
helperClass={styles.helper}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -20,6 +20,11 @@
|
||||||
// width: 25%;
|
// width: 25%;
|
||||||
// float: left;
|
// float: left;
|
||||||
// padding: $gap / 2;
|
// padding: $gap / 2;
|
||||||
z-index: 10;
|
z-index: 1;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.helper {
|
||||||
|
opacity: 0.5;
|
||||||
|
z-index: 10;
|
||||||
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
padding-bottom: 100%;
|
padding-bottom: 100%;
|
||||||
border-radius: $radius;
|
border-radius: $radius;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
user-select: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.thumb_wrap {
|
.thumb_wrap {
|
||||||
|
@ -30,7 +31,8 @@
|
||||||
border-radius: $radius;
|
border-radius: $radius;
|
||||||
background: no-repeat 50% 50%;
|
background: no-repeat 50% 50%;
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
opacity: 0.3;
|
opacity: 1;
|
||||||
|
filter: saturate(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
.progress {
|
.progress {
|
||||||
|
@ -50,4 +52,8 @@
|
||||||
// stroke: white
|
// stroke: white
|
||||||
fill: white;
|
fill: white;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.helper {
|
||||||
|
opacity: 0.3;
|
||||||
|
}
|
||||||
|
|
|
@ -73,8 +73,9 @@ export interface IFileWithUUID {
|
||||||
|
|
||||||
export interface IBlock {
|
export interface IBlock {
|
||||||
type: 'image' | 'text' | 'media' | 'youtube' | 'video';
|
type: 'image' | 'text' | 'media' | 'youtube' | 'video';
|
||||||
temp_ids: UUID[];
|
files: UUID[];
|
||||||
attaches: UUID[];
|
content: string;
|
||||||
|
embeds: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface INode {
|
export interface INode {
|
||||||
|
@ -84,7 +85,7 @@ export interface INode {
|
||||||
title: string;
|
title: string;
|
||||||
files: IFile[];
|
files: IFile[];
|
||||||
|
|
||||||
cover: IFile['id'];
|
cover: IFile;
|
||||||
type: 'image';
|
type: 'image';
|
||||||
|
|
||||||
blocks: IBlock[];
|
blocks: IBlock[];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue