Debian Codegraph @

examples/react-spa/frontend/src/socialaccount/ProviderList.js

raw
1 import { useConfig } from '../auth'
2 import { redirectToProvider, Client, settings } from '../lib/allauth'
3 import Button from '../components/Button'
4 import GoogleOneTap from './GoogleOneTap'
5
6 export default function ProviderList (props) {
7 const config = useConfig()
8 const providers = config.data.socialaccount.providers
9 if (!providers.length) {
10 return null
11 }
12 return (
13 <>
14 <GoogleOneTap process={props.process} />
15 {settings.client === Client.BROWSER && <ul>
16 {providers.map(provider => {
17 return (
18 <li key={provider.id}>
19 <Button onClick={() => redirectToProvider(provider.id, props.callbackURL, props.process)}>{provider.name}</Button>
20 </li>
21 )
22 })}
23 </ul>}
24 </>
25 )
26 }