Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 3263 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 3263 Rev 3719
Línea 1... Línea 1...
1
import React from 'react'
1
import React from 'react';
2
import { useSelector } from 'react-redux'
2
import { useSelector } from 'react-redux';
3
import { Button, styled } from '@mui/material'
3
import { Button, styled } from '@mui/material';
4
 
4
 
5
import List from '@components/common/list'
5
import List from '@components/common/list';
6
import { FacebookIcon, GoogleIcon, XIcon } from '@components/common/icons'
6
import { FacebookIcon, GoogleIcon, XIcon } from '@components/common/icons';
7
 
7
 
8
const SocialButton = styled(Button)`
8
const SocialButton = styled(Button)`
9
  background-color: white;
9
  background-color: white;
10
  border: 1px solid black;
10
  border: 1px solid black;
11
  padding: 0.5rem 1rem;
11
  padding: 0.5rem 1rem;
12
  font-size: 1rem;
12
  font-size: 1rem;
13
  color: #383838;
13
  color: #383838;
14
  width: 100%;
14
  width: 100%;
15
  box-sizing: border-box;
15
  box-sizing: border-box;
16
  margin-bottom: 10px;
16
  margin-bottom: 10px;
17
  svg {
17
  svg {
18
    width: 16px;
18
    width: 16px;
19
    height: 16px;
19
    height: 16px;
20
  }
20
  }
21
`
21
`;
22
 
22
 
23
export default function SocialNetworksSignin({
23
export default function SocialNetworksSignin({
24
  facebookOauth = '/signin/facebook',
24
  facebookOauth = '/signin/facebook',
25
  twitterOauth = '/signin/twitter',
25
  twitterOauth = '/signin/twitter',
26
  googleOauth = '/signin/google'
26
  googleOauth = '/signin/google'
27
}) {
27
}) {
28
  const { access_usign_social_networks } = useSelector((state) => state.auth)
28
  const { access_usign_social_networks } = useSelector((state) => state.auth);
29
 
29
 
30
  const socialNetworksAccessAllowed = access_usign_social_networks === 'y'
30
  const socialNetworksAccessAllowed = access_usign_social_networks === 'y';
31
 
31
 
32
  const options = [
32
  const options = [
33
    { label: 'Facebook', icon: <FacebookIcon />, href: facebookOauth },
33
    { label: 'Facebook', icon: <FacebookIcon />, href: facebookOauth },
34
    { label: 'Twitter', icon: <XIcon />, href: twitterOauth },
34
    { label: 'Twitter', icon: <XIcon />, href: twitterOauth },
35
    { label: 'Google', icon: <GoogleIcon />, href: googleOauth }
35
    { label: 'Google', icon: <GoogleIcon />, href: googleOauth }
36
  ]
36
  ];
37
 
37
 
38
  if (!socialNetworksAccessAllowed) return
38
  if (!socialNetworksAccessAllowed) return;
39
 
39
 
40
  return (
40
  return (
41
    <List
41
    <List
42
      items={options}
42
      items={options}
43
      renderItem={({ icon, label }) => (
43
      renderItem={({ icon, label }) => (
44
        <SocialButton>
44
        <SocialButton>
45
          {icon}
45
          {icon}
46
          {label}
46
          {label}
47
        </SocialButton>
47
        </SocialButton>
48
      )}
48
      )}
49
    />
49
    />
50
  )
50
  );
51
}
51
}