feat: add externalLink and getDomain utilities

master
Katja Lutz 2 years ago
parent b760357e16
commit 0fc1dbc6c5

@ -65,7 +65,10 @@ export const shuffle = (list: any[]) => {
return list; return list;
}; };
export const getHost = () => "https://rappli.ch"; export const getDomain = () =>
import.meta.env.SSR ? process.env.DOMAIN || "localhost" : location.hostname;
export const getHost = () => `https://${getDomain()}`;
export const onClickFocus: JSX.EventHandlerUnion< export const onClickFocus: JSX.EventHandlerUnion<
HTMLAnchorElement, HTMLAnchorElement,
@ -83,3 +86,5 @@ export const onClickFocus: JSX.EventHandlerUnion<
targetEl.focus(); targetEl.focus();
}; };
export const externalLink = { target: "_blank", rel: "noopener" };

Loading…
Cancel
Save