feat: inline critical css

This commit is contained in:
2023-08-08 11:18:54 +02:00
parent 899f5bca85
commit 6123956f08
5 changed files with 40 additions and 38 deletions

View File

@ -4,6 +4,7 @@ import { useEventListener } from "@lib/hooks/useEventListener.ts";
import { menus } from "@islands/KMenu/commands.ts";
import { MenuEntry } from "@islands/KMenu/types.ts";
import * as icons from "@components/icons.tsx";
import { IS_BROWSER } from "$fresh/runtime.ts";
const KMenuEntry = (
{ entry, activeIndex, index }: {
entry: MenuEntry;
@ -150,7 +151,7 @@ export const KMenu = (
} else {
input.current?.blur();
}
}, typeof document !== "undefined" ? document?.body : undefined);
}, IS_BROWSER ? document?.body : undefined);
return (
<div

View File

@ -2,14 +2,10 @@ import { useEffect, useRef, useState } from "preact/hooks";
import useDebouncedCallback from "@lib/hooks/useDebouncedCallback.ts";
import { IconGhost, IconLoader2, IconSearch } from "@components/icons.tsx";
import { useEventListener } from "@lib/hooks/useEventListener.ts";
import { SearchResponse } from "https://raw.githubusercontent.com/bradenmacdonald/typesense-deno/main/src/Typesense/Documents.ts";
import { Recipe } from "@lib/resource/recipes.ts";
import { Movie } from "@lib/resource/movies.ts";
import { Article } from "@lib/resource/articles.ts";
import { useTraceUpdate } from "@lib/hooks/useTraceProps.ts";
import { SearchResult } from "@lib/types.ts";
import { resources } from "@lib/resources.ts";
import { isLocalImage } from "@lib/string.ts";
import { IS_BROWSER } from "$fresh/runtime.ts";
export const RedirectSearchHandler = () => {
useEventListener("keydown", (e: KeyboardEvent) => {
@ -20,7 +16,7 @@ export const RedirectSearchHandler = () => {
) {
window.location.href += "?q=";
}
}, typeof document !== "undefined" ? document?.body : undefined);
}, IS_BROWSER ? document?.body : undefined);
return <></>;
};