Skip to content

Commit

Permalink
feat: use custom SignOutButton to apply custom CSS styles, unified wi…
Browse files Browse the repository at this point in the history
…th other nav links
  • Loading branch information
ixartz committed Nov 22, 2023
1 parent a91f54f commit 35094bf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/app/(auth)/dashboard/layout.tsx
@@ -1,6 +1,6 @@
import { SignOutButton } from '@clerk/nextjs';
import Link from 'next/link';

import { SignOutButton } from '@/components/SignOutButton';
import { AppConfig } from '@/utils/AppConfig';

export default function DashboardLayout({
Expand Down
16 changes: 10 additions & 6 deletions src/components/SignOutButton.tsx
@@ -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 };

0 comments on commit 35094bf

Please sign in to comment.