2021-06-10 19:25:14 +02:00
|
|
|
import PropTypes from 'prop-types'
|
|
|
|
|
import Link from 'next/link'
|
2022-10-26 00:33:01 +04:00
|
|
|
import Image from 'next/image'
|
2022-02-03 01:59:49 +04:00
|
|
|
import {signIn} from 'next-auth/react'
|
2021-06-10 19:25:14 +02:00
|
|
|
|
2022-10-26 00:33:01 +04:00
|
|
|
export default function LoginProvider({id, title, width, height, callbackUrl}) {
|
2021-06-10 19:25:14 +02:00
|
|
|
const hanleClick = event => {
|
|
|
|
|
event.preventDefault()
|
2021-06-26 12:20:16 +02:00
|
|
|
signIn(id, {
|
|
|
|
|
callbackUrl
|
|
|
|
|
})
|
2021-06-10 19:25:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
2022-01-18 09:08:26 +04:00
|
|
|
<Link passHref href='/api/auth/signin'>
|
2022-10-26 00:33:01 +04:00
|
|
|
<Image
|
|
|
|
|
style={{cursor: 'pointer'}}
|
|
|
|
|
width={width}
|
|
|
|
|
height={height}
|
|
|
|
|
alt={title}
|
|
|
|
|
src={`/images/${id}.svg`}
|
2021-06-10 19:25:14 +02:00
|
|
|
onClick={hanleClick}
|
2022-10-26 00:33:01 +04:00
|
|
|
/>
|
2021-06-10 19:25:14 +02:00
|
|
|
</Link>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
LoginProvider.propTypes = {
|
|
|
|
|
id: PropTypes.string.isRequired,
|
|
|
|
|
title: PropTypes.string.isRequired,
|
2022-10-26 00:33:01 +04:00
|
|
|
width: PropTypes.number.isRequired,
|
|
|
|
|
height: PropTypes.number.isRequired,
|
2021-06-26 12:20:16 +02:00
|
|
|
callbackUrl: PropTypes.string.isRequired
|
2021-06-10 19:25:14 +02:00
|
|
|
}
|