-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f44ba87
commit ac95031
Showing
7 changed files
with
147 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import React, { Suspense } from "react"; | ||
import { signIn, signOut, useSession } from "next-auth/react"; | ||
|
||
import Head from "next/head"; | ||
|
||
interface BaseLayoutProps { | ||
title: string; | ||
children?: React.ReactNode; | ||
} | ||
|
||
export const BaseLayout: React.FC<BaseLayoutProps> = ({ children, title }) => { | ||
const { status, data } = useSession(); | ||
|
||
return ( | ||
<Suspense> | ||
<Head> | ||
<title>{`Shortcut | ${title}`} </title> | ||
<meta name="description" content="Short Cut | Fastest URL Shortner" /> | ||
<link rel="icon" href="/favicon.ico" /> | ||
</Head> | ||
<div className="navbar bg-base-100"> | ||
<div className="flex-1"> | ||
<a className="btn btn-ghost normal-case text-xl">Short Cut</a> | ||
</div> | ||
<div className="flex-none gap-2"> | ||
{status === "unauthenticated" ? ( | ||
<button className="btn btn-primary" onClick={() => signIn()}> | ||
Sign in | ||
</button> | ||
) : ( | ||
<button className="btn btn-primary" onClick={() => signOut()}> | ||
Sign out | ||
</button> | ||
)} | ||
</div> | ||
</div> | ||
{children} | ||
</Suspense> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters