chore: polish some components

This commit is contained in:
reya
2023-12-30 09:02:39 +07:00
parent 55d6318614
commit ddbbcf41b5
11 changed files with 44 additions and 28 deletions
@@ -1,4 +1,5 @@
import { CheckCircleIcon, DownloadIcon } from "@lume/icons";
import { getImageMeta } from "@lume/utils";
import { downloadDir } from "@tauri-apps/api/path";
import { Window } from "@tauri-apps/api/window";
import { download } from "@tauri-apps/plugin-upload";
@@ -21,8 +22,15 @@ export function ImagePreview({ url }: { url: string }) {
}
};
const open = () => {
return new Window("image-viewer", { url, title: "Image Viewer" });
const open = async () => {
const name = new URL(url).pathname.split("/").pop();
const image = await getImageMeta(url);
return new Window("image-viewer", {
url,
title: name,
width: image.width,
height: image.height,
});
};
const fallback = (event: SyntheticEvent<HTMLImageElement, Event>) => {