Now supports running under a sub path
Just set the SPOOLMAN_BASE_PATH environment variable and it should work. Resolves #95
This commit is contained in:
20
client/src/components/favicon.tsx
Normal file
20
client/src/components/favicon.tsx
Normal file
@@ -0,0 +1,20 @@
|
||||
import { useEffect } from "react";
|
||||
|
||||
/**
|
||||
* Renders a favicon element in the head of the HTML document with the specified URL.
|
||||
*
|
||||
* @param {string} props.url - The URL of the favicon image.
|
||||
* @return {JSX.Element} - An empty JSX element.
|
||||
*/
|
||||
export function Favicon(props: { url: string }) {
|
||||
useEffect(() => {
|
||||
let link = document.querySelector("link[rel~='icon']") as HTMLLinkElement;
|
||||
if (!link) {
|
||||
link = document.createElement("link") as HTMLLinkElement;
|
||||
link.rel = "icon";
|
||||
document.getElementsByTagName("head")[0].appendChild(link);
|
||||
}
|
||||
link.href = props.url;
|
||||
}, [props.url]);
|
||||
return <></>;
|
||||
}
|
||||
Reference in New Issue
Block a user