Migrate from DaisyUI to SkeletonUI

This commit is contained in:
2024-12-12 23:29:24 +01:00
parent 2f934537a2
commit 8060c4971d
15 changed files with 396 additions and 414 deletions

View File

@ -1,11 +1,37 @@
export const get_image_preview_event_handler = (id: string) => {
const handler = (event) => {
const target = event.target;
const files = target.files;
/**
* Use this on <Avatar> components.
*/
export const get_avatar_preview_event_handler = (id: string) => {
const handler = (event: Event) => {
const target: HTMLInputElement = event.target as HTMLInputElement;
const files: FileList | null = target.files;
if (files.length > 0) {
const src = URL.createObjectURL(files[0]);
const preview = document.getElementById(id) as HTMLImageElement;
if (files && files.length > 0) {
const src: string = URL.createObjectURL(files[0]);
const preview: HTMLImageElement = document.querySelector(
`#${id} > img:first-of-type`,
) as HTMLImageElement;
if (preview) {
preview.src = src;
preview.hidden = false;
}
}
};
return handler;
};
/**
* Use this on raw <img> elements.
*/
export const get_image_preview_event_handler = (id: string) => {
const handler = (event: Event) => {
const target: HTMLInputElement = event.target as HTMLInputElement;
const files: FileList | null = target.files;
if (files && files.length > 0) {
const src: string = URL.createObjectURL(files[0]);
const preview: HTMLImageElement = document.getElementById(id) as HTMLImageElement;
if (preview) {
preview.src = src;
preview.hidden = false;