-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use custom SignOutButton to apply custom CSS styles, unified wi…
…th other nav links
- Loading branch information
Showing
2 changed files
with
11 additions
and
7 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 |
---|---|---|
@@ -1,17 +1,21 @@ | ||
'use client'; | ||
|
||
import { SignOutButton as SignOutButtonClerk } from '@clerk/nextjs'; | ||
import { redirect } from 'next/navigation'; | ||
import { useClerk } from '@clerk/nextjs'; | ||
import { useRouter } from 'next/navigation'; | ||
|
||
const SignOutButton = () => ( | ||
<SignOutButtonClerk signOutCallback={() => redirect('/')}> | ||
const SignOutButton = () => { | ||
const router = useRouter(); | ||
const { signOut } = useClerk(); | ||
|
||
return ( | ||
<button | ||
className="border-none text-gray-700 hover:text-gray-900" | ||
type="button" | ||
onClick={() => signOut(() => router.push('/'))} | ||
> | ||
Sign out | ||
</button> | ||
</SignOutButtonClerk> | ||
); | ||
); | ||
}; | ||
|
||
export { SignOutButton }; |