Add Button to LoginProvider

This commit is contained in:
Cédric FAMIBELLE-PRONZOLA
2022-10-31 23:01:33 +04:00
parent a20d0d4142
commit 4de3bb1f97
2 changed files with 19 additions and 15 deletions
+7 -7
View File
@@ -35,20 +35,20 @@ const PROVIDERS = [
{ {
id: 'google', id: 'google',
title: 'Google', title: 'Google',
width: 46, width: 16,
height: 46 height: 16
}, },
{ {
id: 'twitter', id: 'twitter',
title: 'Twitter', title: 'Twitter',
width: 56, width: 16,
height: 46 height: 13
}, },
{ {
id: 'github', id: 'github',
title: 'GitHub', title: 'GitHub',
width: 52, width: 16,
height: 51 height: 15
} }
] ]
@@ -258,7 +258,7 @@ function Koneksyon({chimen}) {
<Box sx={{textAlign: 'center', marginBottom: 3}}> <Box sx={{textAlign: 'center', marginBottom: 3}}>
<Typography gutterBottom textAlign='center'>Connectez-vous avec</Typography> <Typography gutterBottom textAlign='center'>Connectez-vous avec</Typography>
<Grid container alignItems='center' justifyContent='center' spacing={5}> <Grid container alignItems='center' justifyContent='center' columnSpacing={{xs: 1, sm: 2, md: 3}}>
{PROVIDERS.map(({id, title, width, height}) => ( {PROVIDERS.map(({id, title, width, height}) => (
<Grid key={id} item marginTop={1}> <Grid key={id} item marginTop={1}>
<LoginProvider id={id} title={title} width={width} height={height} callbackUrl={`${siteUrl}${chimen}`} /> <LoginProvider id={id} title={title} width={width} height={height} callbackUrl={`${siteUrl}${chimen}`} />
+12 -8
View File
@@ -3,6 +3,7 @@ import Link from 'next/link'
import Image from 'next/image' import Image from 'next/image'
import {signIn} from 'next-auth/react' import {signIn} from 'next-auth/react'
import {useTheme} from '@mui/material/styles' import {useTheme} from '@mui/material/styles'
import Button from '@mui/material/Button'
export default function LoginProvider({id, title, width, height, callbackUrl}) { export default function LoginProvider({id, title, width, height, callbackUrl}) {
const theme = useTheme() const theme = useTheme()
@@ -16,14 +17,17 @@ export default function LoginProvider({id, title, width, height, callbackUrl}) {
return ( return (
<Link passHref href='/api/auth/signin'> <Link passHref href='/api/auth/signin'>
<Image <Button variant='outlined' color='inherit' startIcon={
style={{cursor: 'pointer'}} <Image
width={width} width={width}
height={height} height={height}
alt={title} alt={title}
src={`/images/${id === 'github' ? `${id}-${theme.palette.mode}` : id}.svg`} src={`/images/${id === 'github' ? `${id}-${theme.palette.mode}` : id}.svg`}
onClick={hanleClick} />
/> } onClick={hanleClick}
>
{title}
</Button>
</Link> </Link>
) )
} }