Skip to content

Commit

Permalink
fix: 🐛 readded navbar layout
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelemedici committed Mar 7, 2024
1 parent ccaecad commit c4c6a37
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 7 deletions.
2 changes: 1 addition & 1 deletion adapters/static/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default extendConfig(baseConfig, () => {
},
plugins: [
staticAdapter({
origin: "https://yoursite.qwik.dev",
origin: "https://trippavisor.it",
}),
],
};
Expand Down
5 changes: 1 addition & 4 deletions src/components/navbar/navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@ import ImgLogo from "~/assets/images/logo.svg?jsx";

export const Navbar = component$(() => {
return (
<nav class="dark:bg-yellow-900 fixed start-0 top-0 z-20 hidden w-full bg-yellow">
<nav class="dark:bg-yellow-900 fixed start-0 top-0 z-20 w-full bg-yellow">
<div class="mx-auto flex flex-wrap items-center justify-between p-4">
<a title="homepage" href="/" class="flex items-center">
<ImgLogo />
</a>
{/* <div class="flex space-x-3 md:order-2 md:space-x-0">
<a href="mailto:[email protected]">Contattaci</a>
</div> */}
</div>
</nav>
);
Expand Down
2 changes: 0 additions & 2 deletions src/routes/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { component$, Slot } from "@builder.io/qwik";
import type { RequestHandler } from "@builder.io/qwik-city";
import { Navbar } from "~/components/navbar/navbar";

export const onGet: RequestHandler = async ({ cacheControl }) => {
// Control caching for this request for best performance and to reduce hosting costs:
Expand All @@ -16,7 +15,6 @@ export const onGet: RequestHandler = async ({ cacheControl }) => {
export default component$(() => {
return (
<>
<Navbar />
<main class="">
<Slot />
</main>
Expand Down
25 changes: 25 additions & 0 deletions src/routes/search/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { component$, Slot } from "@builder.io/qwik";
import type { RequestHandler } from "@builder.io/qwik-city";
import { Navbar } from "~/components/navbar/navbar";

export const onGet: RequestHandler = async ({ cacheControl }) => {
// Control caching for this request for best performance and to reduce hosting costs:
// https://qwik.builder.io/docs/caching/
cacheControl({
// Always serve a cached response by default, up to a week stale
staleWhileRevalidate: 60 * 60 * 24 * 7,
// Max once every 5 seconds, revalidate on the server to get a fresh version of this page
maxAge: 5,
});
};

export default component$(() => {
return (
<>
<Navbar />
<main class="mt-16">
<Slot />
</main>
</>
);
});

0 comments on commit c4c6a37

Please sign in to comment.