import { Head } from "$fresh/runtime.ts"; import { Handlers, PageProps } from "$fresh/server.ts"; import { RepoData, getRepos, searchRepos } from "../api/repo.ts"; import { useState } from "preact/hooks"; import { SearchBar } from "../components/SearchBar.tsx"; import RepoViewer from "../islands/RepoViewer.tsx"; export const handler: Handlers = { async GET(req, ctx) { try { const url = new URL(req.url); const query = url.searchParams.get("q"); if (query) { const repos = await searchRepos(query); return ctx.render(repos); } else { const repos = await getRepos(); return ctx.render(repos); } } catch (error) { console.error(error); return ctx.render(null); } } } export default function Home({ data }: PageProps) { const [searchValue, setSearchValue] = useState(""); return ( <> Search Github Awesome App

Search Github Awesome App

{ }} />
); }