2016-07-15 14:32:42 -07:00
|
|
|
import React, { PropTypes } from 'react';
|
|
|
|
import { Button } from 'react-bootstrap';
|
|
|
|
import FA from 'react-fontawesome';
|
2016-09-28 21:26:17 +07:00
|
|
|
import classnames from 'classnames';
|
2016-07-15 14:32:42 -07:00
|
|
|
|
2017-01-12 06:54:43 +00:00
|
|
|
const propTypes = {
|
|
|
|
isGithubCool: PropTypes.bool,
|
|
|
|
isLinkedIn: PropTypes.bool,
|
|
|
|
isTwitter: PropTypes.bool
|
|
|
|
};
|
|
|
|
|
2016-07-15 14:32:42 -07:00
|
|
|
export default function SocialSettings({
|
|
|
|
isGithubCool,
|
|
|
|
isTwitter,
|
|
|
|
isLinkedIn
|
|
|
|
}) {
|
|
|
|
const githubCopy = isGithubCool ?
|
2016-09-14 15:56:35 -04:00
|
|
|
'Update my profile from GitHub' :
|
2016-07-15 14:32:42 -07:00
|
|
|
'Link my GitHub to unlock my portfolio';
|
|
|
|
const buttons = [
|
|
|
|
<Button
|
|
|
|
block={ true }
|
|
|
|
bsSize='lg'
|
|
|
|
className='btn-link-social btn-github'
|
|
|
|
href='/link/github'
|
|
|
|
key='github'
|
|
|
|
>
|
|
|
|
<FA name='github' />
|
|
|
|
{ githubCopy }
|
|
|
|
</Button>
|
|
|
|
];
|
2016-09-28 21:26:17 +07:00
|
|
|
const socials = [
|
|
|
|
{
|
|
|
|
isActive: isTwitter,
|
|
|
|
identifier: 'twitter',
|
|
|
|
text: 'Twitter'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
isActive: isLinkedIn,
|
|
|
|
identifier: 'linkedin',
|
|
|
|
text: 'LinkedIn'
|
|
|
|
}
|
|
|
|
];
|
|
|
|
if (isGithubCool) {
|
|
|
|
socials.forEach(({ isActive, identifier, text }) => {
|
|
|
|
const socialClass = classnames(
|
|
|
|
'btn-link-social',
|
|
|
|
`btn-${identifier}`,
|
|
|
|
{ active: isActive }
|
|
|
|
);
|
|
|
|
const socialLink = isActive ?
|
|
|
|
`/account/unlink/${identifier}` :
|
|
|
|
`/link/${identifier}`;
|
|
|
|
const socialText = isTwitter ?
|
|
|
|
`Remove my ${text} from my portfolio` :
|
|
|
|
`Add my ${text} to my portfolio`;
|
|
|
|
buttons.push((
|
|
|
|
<Button
|
|
|
|
block={ true }
|
|
|
|
bsSize='lg'
|
|
|
|
className={ socialClass }
|
|
|
|
href={ socialLink }
|
|
|
|
key={ identifier }
|
|
|
|
>
|
|
|
|
<FA name={ identifier } />
|
|
|
|
{ socialText }
|
|
|
|
</Button>
|
|
|
|
));
|
|
|
|
});
|
2016-07-15 14:32:42 -07:00
|
|
|
}
|
|
|
|
return (<div>{ buttons }</div>);
|
|
|
|
}
|
|
|
|
|
2017-01-12 06:54:43 +00:00
|
|
|
SocialSettings.displayName = 'SocialSettings';
|
|
|
|
SocialSettings.propTypes = propTypes;
|