fix: dropdown menu
This commit is contained in:
parent
615e8e6384
commit
7ce8ae0867
8 changed files with 230 additions and 119 deletions
|
|
@ -1,26 +1,22 @@
|
|||
'use client'
|
||||
|
||||
import * as React from 'react'
|
||||
import { signIn } from 'next-auth/react'
|
||||
|
||||
import { cn } from '@/lib/utils'
|
||||
import { Button, type ButtonProps } from '@/components/ui/button'
|
||||
import { IconGitHub, IconSpinner } from '@/components/ui/icons'
|
||||
import { signIn } from 'next-auth/react'
|
||||
import { IconSpinner } from '@/components/ui/icons'
|
||||
|
||||
interface LoginButtonProps extends ButtonProps {
|
||||
text?: string
|
||||
}
|
||||
|
||||
export function LoginButton({
|
||||
className,
|
||||
text = 'Login with GitHub',
|
||||
...props
|
||||
}: LoginButtonProps) {
|
||||
export function LoginButton({ className, ...props }: LoginButtonProps) {
|
||||
const [isLoading, setIsLoading] = React.useState(false)
|
||||
|
||||
return (
|
||||
<Button
|
||||
variant="outline"
|
||||
variant="link"
|
||||
onClick={() => {
|
||||
setIsLoading(true)
|
||||
signIn('github')
|
||||
|
|
@ -29,12 +25,8 @@ export function LoginButton({
|
|||
className={cn(className)}
|
||||
{...props}
|
||||
>
|
||||
{isLoading ? (
|
||||
<IconSpinner className="mr-2 animate-spin" />
|
||||
) : (
|
||||
<IconGitHub className="mr-2" />
|
||||
)}
|
||||
{text}
|
||||
{isLoading && <IconSpinner className="mr-2 animate-spin" />}
|
||||
Login
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue