Files
threshold/website/components/auth-indicator/index.jsx
T
Jimmy Merritello f7ac991d32 [Website] Add Auth0 when ready (#440)
* Add auth0

* Style tweaks in line with wp
2020-09-25 14:12:35 -05:00

28 lines
760 B
React

import { signOut, useSession } from 'next-auth/client'
import styles from './auth-indicator.module.css'
import Button from '@hashicorp/react-button'
export default function AuthIndicator() {
const [session, loading] = useSession()
if (loading) return `Loading...`
return (
<div className={styles.authIndicator}>
{session && (
<>
<span className={`g-type-label ${styles.loggedInText}`}>
Signed in as {session.user.email}
</span>
<span>
<Button
onClick={signOut}
title={`Sign out`}
size="small"
theme={{ variant: 'secondary-neutral', background: 'dark' }}
/>
</span>
</>
)}
</div>
)
}