feat: add initial recommendation data
This commit is contained in:
@ -20,48 +20,18 @@ export type Props = {
|
||||
export const MainLayout = (
|
||||
{ children, url, title, context, searchResults }: Props,
|
||||
) => {
|
||||
const hasSearch = url.search.includes("q=");
|
||||
const _url = typeof url === "string" ? new URL(url) : url;
|
||||
const hasSearch = _url.search.includes("q=");
|
||||
|
||||
return (
|
||||
<div
|
||||
class="md:grid mx-auto"
|
||||
style={{ gridTemplateColumns: "200px 1fr", maxWidth: "1024px" }}
|
||||
>
|
||||
<Head>
|
||||
<style>{CSS}</style>
|
||||
<style>{KATEX_CSS}</style>
|
||||
{title &&
|
||||
<title>{title}</title>}
|
||||
</Head>
|
||||
<aside class="p-4 hidden md:block">
|
||||
<nav class="min-h-fit rounded-3xl p-3 grid gap-3 fixed t-0">
|
||||
{Object.values(resources).map((m) => {
|
||||
return (
|
||||
<a
|
||||
href={m.link}
|
||||
class={`flex items-center gap-2 ${
|
||||
m.link === url.pathname ? "bg-white text-black" : "text-white"
|
||||
} p-3 text-xl w-full rounded-2xl`}
|
||||
>
|
||||
{<Emoji class="w-6 h-6" name={m.emoji} />} {m.name}
|
||||
</a>
|
||||
);
|
||||
})}
|
||||
</nav>
|
||||
</aside>
|
||||
<main
|
||||
class="py-5"
|
||||
style={{ fontFamily: "Work Sans" }}
|
||||
>
|
||||
{hasSearch && (
|
||||
<Search
|
||||
q={url.searchParams.get("q")}
|
||||
{...context}
|
||||
results={searchResults}
|
||||
/>
|
||||
)}
|
||||
{!hasSearch && children}
|
||||
</main>
|
||||
</div>
|
||||
);
|
||||
if (hasSearch) {
|
||||
return (
|
||||
<Search
|
||||
q={_url.searchParams.get("q")}
|
||||
{...context}
|
||||
results={searchResults}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
return <>{children}</>;
|
||||
};
|
||||
|
Reference in New Issue
Block a user