Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
Bit-Barron committed Oct 29, 2024
1 parent 386cdc6 commit 034fc5b
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 12 deletions.
32 changes: 23 additions & 9 deletions src/lib/components/container/navbar/navbar.svelte
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<script>
import { Home, DollarSign, Mail, LogIn } from 'lucide-svelte';
<script lang="ts">
import { Home, DollarSign, Mail, LogIn, LogOut } from 'lucide-svelte';
import { goto } from '$app/navigation';
export let data;
console.log('navar', data);
</script>

<header class="flex items-center justify-between p-4">
Expand All @@ -18,10 +17,25 @@
<Mail class="mr-2 h-4 w-4" /> Contact
</button>
</nav>
<button
on:click={() => goto('/login')}
class="flex items-center rounded-full bg-red-500 px-4 py-2 text-white transition-colors duration-200 hover:bg-red-600"
>
<LogIn class="mr-2 h-4 w-4" /> Log In
</button>

{#if data.user}
<div class="flex items-center space-x-4">
<span class="text-white">{data.user.email}</span>
<form action="/logout" method="POST">
<button
type="submit"
class="flex items-center rounded-full bg-red-500 px-4 py-2 text-white transition-colors duration-200 hover:bg-red-600"
>
<LogOut class="mr-2 h-4 w-4" /> Log Out
</button>
</form>
</div>
{:else}
<button
on:click={() => goto('/login')}
class="flex items-center rounded-full bg-red-500 px-4 py-2 text-white transition-colors duration-200 hover:bg-red-600"
>
<LogIn class="mr-2 h-4 w-4" /> Log In
</button>
{/if}
</header>
4 changes: 1 addition & 3 deletions src/routes/(home)/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@
];
export let data;
console.log(data);
</script>

<div class="min-h-screen bg-gradient-to-br font-sans text-white">
<Navbar />
<Navbar data />

<main class="container mx-auto px-4 py-16 text-center">
<h1 in:fly={{ y: -50, duration: 500 }} class="mb-8 text-6xl font-bold">
Expand Down
7 changes: 7 additions & 0 deletions src/routes/+layout.server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import type { LayoutServerLoad } from './$types';

export const load: LayoutServerLoad = async ({ locals }) => {
return {
user: locals.user
};
};

0 comments on commit 034fc5b

Please sign in to comment.