mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-24 20:36:40 +07:00
tried grid
This commit is contained in:
parent
10b013f9a8
commit
125a120c85
6 changed files with 25 additions and 17 deletions
|
@ -86,14 +86,8 @@ const ImageEditorUnconnected: FC<IProps> = ({ data, setData, uploadUploadFiles,
|
|||
useEffect(() => console.log({ data }), [data]);
|
||||
|
||||
useEffect(() => {
|
||||
console.log({ temp, files });
|
||||
|
||||
Object.entries(statuses).forEach(([id, status]) => {
|
||||
// todo: make this working
|
||||
console.log({ id, uuid: status.uuid, file: files[status.uuid], files });
|
||||
|
||||
if (temp.includes(id) && !!status.uuid && files[status.uuid]) {
|
||||
console.log(`${id} uploaded`);
|
||||
onFileAdd(files[status.uuid]);
|
||||
setTemp(temp.filter(el => el !== id));
|
||||
}
|
||||
|
@ -103,7 +97,7 @@ const ImageEditorUnconnected: FC<IProps> = ({ data, setData, uploadUploadFiles,
|
|||
return (
|
||||
<ImageGrid
|
||||
items={data.files}
|
||||
locked={temp.map(id => statuses[id])}
|
||||
locked={temp.filter(id => !!statuses[id]).map(id => statuses[id])}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -17,7 +17,7 @@ const SortableList = SortableContainer(({ items, locked }: { items: IFile[], loc
|
|||
<div className={styles.grid}>
|
||||
{
|
||||
items.map((file, index) => (
|
||||
<SortableItem key={file.id} index={index}>
|
||||
<SortableItem key={file.id} index={index} collection={0}>
|
||||
<ImageUpload
|
||||
id={file.id}
|
||||
thumb={file.url}
|
||||
|
@ -25,6 +25,17 @@ const SortableList = SortableContainer(({ items, locked }: { items: IFile[], loc
|
|||
</SortableItem>
|
||||
))
|
||||
}
|
||||
{
|
||||
locked.map((item, index) => (
|
||||
<SortableItem key={item.temp_id} index={index} collection={1} disabled>
|
||||
<ImageUpload
|
||||
thumb={item.preview}
|
||||
progress={item.progress}
|
||||
is_uploading
|
||||
/>
|
||||
</SortableItem>
|
||||
))
|
||||
}
|
||||
<div style={{ clear: 'both' }} />
|
||||
</div>
|
||||
);
|
||||
|
|
|
@ -3,22 +3,22 @@
|
|||
padding-bottom: 60px;
|
||||
box-sizing: border-box;
|
||||
|
||||
// display: grid;
|
||||
// grid-column-gap: $gap;
|
||||
// grid-row-gap: $gap;
|
||||
// grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
|
||||
display: grid;
|
||||
grid-column-gap: $gap;
|
||||
grid-row-gap: $gap;
|
||||
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
|
||||
|
||||
// display: flex;
|
||||
// flex-wrap: wrap;
|
||||
// @media (max-width: 600px) {
|
||||
// grid-template-columns: repeat(auto-fill, minmax(30vw, 1fr));
|
||||
// }
|
||||
@media (max-width: 600px) {
|
||||
grid-template-columns: repeat(auto-fill, minmax(30vw, 1fr));
|
||||
}
|
||||
}
|
||||
|
||||
.item {
|
||||
// flex: 0 4 25%;
|
||||
width: 25%;
|
||||
float: left;
|
||||
// width: 25%;
|
||||
// float: left;
|
||||
// padding: $gap / 2;
|
||||
z-index: 100;
|
||||
box-sizing: border-box;
|
||||
|
|
|
@ -37,4 +37,5 @@ export const EMPTY_UPLOAD_STATUS: IUploadStatus = {
|
|||
progress: 0,
|
||||
thumbnail_url: null,
|
||||
type: null,
|
||||
temp_id: null,
|
||||
}
|
|
@ -11,6 +11,7 @@ export interface IUploadStatus {
|
|||
type: string;
|
||||
thumbnail_url: string;
|
||||
progress: number;
|
||||
temp_id: UUID;
|
||||
}
|
||||
|
||||
export interface IUploadState {
|
||||
|
|
|
@ -49,6 +49,7 @@ function* uploadFile({ file, temp_id }: IFileWithUUID) {
|
|||
preview,
|
||||
is_uploading: true,
|
||||
type: file.type,
|
||||
temp_id,
|
||||
}
|
||||
)
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue