Create LoginProvider component
This commit is contained in:
@@ -0,0 +1,30 @@
|
|||||||
|
import PropTypes from 'prop-types'
|
||||||
|
import Link from 'next/link'
|
||||||
|
import {signIn} from 'next-auth/client'
|
||||||
|
import {Button} from '@material-ui/core'
|
||||||
|
|
||||||
|
export default function LoginProvider({id, title, icon}) {
|
||||||
|
const hanleClick = event => {
|
||||||
|
event.preventDefault()
|
||||||
|
signIn(id)
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Link href='/api/auth/signin'>
|
||||||
|
<Button
|
||||||
|
variant='contained'
|
||||||
|
color='primary'
|
||||||
|
startIcon={icon}
|
||||||
|
onClick={hanleClick}
|
||||||
|
>
|
||||||
|
{title} koneksyon
|
||||||
|
</Button>
|
||||||
|
</Link>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
LoginProvider.propTypes = {
|
||||||
|
id: PropTypes.string.isRequired,
|
||||||
|
title: PropTypes.string.isRequired,
|
||||||
|
icon: PropTypes.node.isRequired
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user