feat: enhance layout of search
This commit is contained in:
@ -7,6 +7,7 @@ export default function App({ Component }: AppProps) {
|
||||
<Head>
|
||||
<link href="/global.css" rel="stylesheet" />
|
||||
<link href="/prism-material-dark.css" rel="stylesheet" />
|
||||
<link rel="icon" type="image/png" href="/favicon.png" />
|
||||
</Head>
|
||||
<Component />
|
||||
</>
|
||||
|
@ -2,6 +2,10 @@ import { Handlers } from "$fresh/server.ts";
|
||||
import { BadRequestError } from "@lib/errors.ts";
|
||||
import { getTypeSenseClient } from "@lib/typesense.ts";
|
||||
import { json } from "@lib/helpers.ts";
|
||||
import { getArticle } from "@lib/resource/articles.ts";
|
||||
import { getMovie } from "@lib/tmdb.ts";
|
||||
import { getRecipe } from "@lib/resource/recipes.ts";
|
||||
import { getDocument } from "@lib/documents.ts";
|
||||
|
||||
export const handler: Handlers = {
|
||||
async GET(req, _ctx) {
|
||||
@ -30,8 +34,9 @@ export const handler: Handlers = {
|
||||
q: query,
|
||||
query_by,
|
||||
filter_by,
|
||||
per_page: 50,
|
||||
});
|
||||
|
||||
return json(searchResults.hits);
|
||||
return json(searchResults);
|
||||
},
|
||||
};
|
||||
|
@ -6,6 +6,7 @@ import { KMenu } from "@islands/KMenu.tsx";
|
||||
import { YoutubePlayer } from "@components/Youtube.tsx";
|
||||
import { HashTags } from "@components/HashTags.tsx";
|
||||
import { isYoutubeLink } from "@lib/string.ts";
|
||||
import { renderMarkdown } from "@lib/documents.ts";
|
||||
|
||||
export const handler: Handlers<Article | null> = {
|
||||
async GET(_, ctx) {
|
||||
@ -19,6 +20,8 @@ export default function Greet(props: PageProps<Article>) {
|
||||
|
||||
const { author = "", date = "" } = article.meta;
|
||||
|
||||
const content = renderMarkdown(article.content);
|
||||
|
||||
return (
|
||||
<MainLayout url={props.url} title={`Article > ${article.name}`}>
|
||||
<RecipeHero
|
||||
@ -43,9 +46,9 @@ export default function Greet(props: PageProps<Article>) {
|
||||
class="whitespace-break-spaces markdown-body"
|
||||
data-color-mode="dark"
|
||||
data-dark-theme="dark"
|
||||
dangerouslySetInnerHTML={{ __html: article.content || "" }}
|
||||
dangerouslySetInnerHTML={{ __html: content || "" }}
|
||||
>
|
||||
{article.content||""}
|
||||
{content||""}
|
||||
</pre>
|
||||
</div>
|
||||
</MainLayout>
|
||||
|
@ -2,7 +2,7 @@ import { Head } from "$fresh/runtime.ts";
|
||||
import { MainLayout } from "@components/layouts/main.tsx";
|
||||
import { Card } from "@components/Card.tsx";
|
||||
import { PageProps } from "$fresh/server.ts";
|
||||
import { menu } from "@lib/menus.ts";
|
||||
import { resources } from "@lib/resources.ts";
|
||||
import { KMenu } from "@islands/KMenu.tsx";
|
||||
|
||||
export default function Home(props: PageProps) {
|
||||
@ -14,10 +14,10 @@ export default function Home(props: PageProps) {
|
||||
<KMenu type="main" context={null} />
|
||||
<MainLayout url={props.url}>
|
||||
<div class="flex flex-wrap items-center gap-4 px-4">
|
||||
{menu.map((m) => {
|
||||
{Object.values(resources).map((m) => {
|
||||
return (
|
||||
<Card
|
||||
title={m.name}
|
||||
title={`${m.emoji} ${m.name}`}
|
||||
image="/placeholder.svg"
|
||||
link={m.link}
|
||||
/>
|
||||
|
@ -4,6 +4,7 @@ import { getMovie, Movie } from "@lib/resource/movies.ts";
|
||||
import { RecipeHero } from "@components/RecipeHero.tsx";
|
||||
import { KMenu } from "@islands/KMenu.tsx";
|
||||
import { HashTags } from "@components/HashTags.tsx";
|
||||
import { renderMarkdown } from "@lib/documents.ts";
|
||||
|
||||
export const handler: Handlers<Movie | null> = {
|
||||
async GET(_, ctx) {
|
||||
@ -17,6 +18,8 @@ export default function Greet(props: PageProps<Movie>) {
|
||||
|
||||
const { author = "", date = "" } = movie.meta;
|
||||
|
||||
const content = renderMarkdown(movie.description || "");
|
||||
|
||||
return (
|
||||
<MainLayout url={props.url} title={`Movie > ${movie.name}`}>
|
||||
<RecipeHero
|
||||
@ -38,9 +41,9 @@ export default function Greet(props: PageProps<Movie>) {
|
||||
: <></>}
|
||||
<pre
|
||||
class="whitespace-break-spaces"
|
||||
dangerouslySetInnerHTML={{ __html: movie.description || "" }}
|
||||
dangerouslySetInnerHTML={{ __html: content || "" }}
|
||||
>
|
||||
{movie.description}
|
||||
{content}
|
||||
</pre>
|
||||
</div>
|
||||
</MainLayout>
|
||||
|
Reference in New Issue
Block a user