From 042d4fa9523edb9b0613902d67452df10078c836 Mon Sep 17 00:00:00 2001 From: Xe Iaso Date: Sat, 29 Apr 2023 13:26:09 -0400 Subject: fucking horrible typescript garbage Signed-off-by: Xe Iaso --- src/frontend/components/MastodonShareButton.tsx | 32 ++++++++++++++----------- 1 file changed, 18 insertions(+), 14 deletions(-) (limited to 'src/frontend/components/MastodonShareButton.tsx') diff --git a/src/frontend/components/MastodonShareButton.tsx b/src/frontend/components/MastodonShareButton.tsx index d809ee9..a0d56f0 100644 --- a/src/frontend/components/MastodonShareButton.tsx +++ b/src/frontend/components/MastodonShareButton.tsx @@ -1,17 +1,15 @@ -// @jsxImportSource xeact -// @jsxRuntime automatic - -import { u, useState } from "xeact"; +import { u } from "@xeserv/xeact"; +import { useState } from 'preact/hooks'; export interface MastodonShareButtonProps { title: string; url: string; series?: string; - tags: string; + tags: string[]; } export default function MastodonShareButton( - { title, url = u(), series, tags }: MastodonShareButtonProps, + { title, url = u("", {}), series, tags }: MastodonShareButtonProps, ) { let defaultURL = localStorage["mastodon_instance"]; @@ -27,8 +25,8 @@ ${series ? "#" + series + " " : ""}${ tags ? tags.map((x) => "#" + x).join(" ") : "" } @cadey@pony.social`; - const [getURL, setURL] = useState(defaultURL); - const [getToot, setToot] = useState(tootTemplate); + const [theURL, setURL] = useState(defaultURL); + const [toot, setToot] = useState(tootTemplate); return (
@@ -40,27 +38,33 @@ ${series ? "#" + series + " " : ""}${ type="text" placeholder="https://pony.social" value={defaultURL} - oninput={(e) => setURL(e.target.value)} + onInput={(e) => { + const target = e.target as HTMLInputElement; + setURL(target.value); + }} />