_layout.tsx (1692B)
1 import { AppState } from "#http/routes/_middleware.ts"; 2 import { Head } from "$fresh/src/runtime/head.ts"; 3 import { PageProps } from "$fresh/src/server/mod.ts"; 4 5 export default function Layout( 6 { Component, state, url }: PageProps<void, AppState>, 7 ) { 8 return ( 9 <> 10 <Head> 11 <title key="title">KYCID</title> 12 </Head> 13 <header class="container"> 14 <nav> 15 <ul> 16 <li> 17 <hgroup> 18 <b> 19 <a href="/">KYCID</a> 20 </b> 21 <p>Know your customer's identity</p> 22 </hgroup> 23 </li> 24 </ul> 25 <ul> 26 <li> 27 {state.forms.session 28 ? ( 29 <form 30 method="POST" 31 action={state.forms.link({ 32 form: "/logout", 33 context: { back: url.href }, 34 }) 35 .href} 36 > 37 <button type="submit"> 38 Logout 39 </button> 40 </form> 41 ) 42 : ( 43 <form 44 method="GET" 45 action={state.forms.link({ 46 form: "/connect", 47 context: { back: url.href }, 48 }).href} 49 > 50 <button type="submit"> 51 Login 52 </button> 53 </form> 54 )} 55 </li> 56 </ul> 57 </nav> 58 </header> 59 60 <main class="container"> 61 <Component /> 62 </main> 63 </> 64 ); 65 }