/ src / routes / typst-test.tsx
typst-test.tsx
 1  import { createResource } from "solid-js";
 2  import { TypstDocument } from "../lib/TypstDocument";
 3  import cfg from "../constant";
 4  
 5  export default function Typstest() {
 6  	const getArtifactData = async () => {
 7  		const response = await fetch(
 8  			(() => {
 9  				const suff = "/readme.artifact.sir.in";
10  				// @ts-ignore
11  				if (import.meta.env.PROD) {
12  					return cfg.base_url + suff;
13  				}
14  				const ret = "http://localhost:3000" + suff;
15  				console.log(ret);
16  				return ret;
17  			})(),
18  		).then((response) => response.arrayBuffer());
19  
20  		return new Uint8Array(response);
21  	};
22  	const [a] = createResource(getArtifactData);
23  
24  	return (
25  		<div class="w-full h-full justify-center items-center flex flex-col">
26  			This is for testing the [WIP] typst solidjs component
27  			<TypstDocument fill="#343541" artifact={a()} />
28  		</div>
29  	);
30  }