fix: add identicon natively (#36633)

This commit is contained in:
mrugesh
2019-08-19 19:17:53 +05:30
committed by GitHub
parent 985daf5e5a
commit 5f97782eb0
5 changed files with 28 additions and 8 deletions

View File

@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
import { Col, Row, Image } from '@freecodecamp/react-bootstrap';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faAward } from '@fortawesome/free-solid-svg-icons';
import Identicon from 'react-identicons';
import SocialIcons from './SocialIcons';
@@ -61,16 +62,29 @@ function Camper({
twitter,
website
}) {
// A lot of the user-profiles are still using the defunct service.
const avatar = /example.com/.test(picture) ? (
<Identicon
bg={'#006400'}
count={5}
fg={'#FCB900'}
padding={5}
size={256}
string={username}
/>
) : (
<Image
alt={username + "'s avatar"}
className='avatar'
responsive={true}
src={picture}
/>
);
return (
<div>
<Row>
<Col className='avatar-container' xs={12}>
<Image
alt={username + "'s avatar"}
className='avatar'
responsive={true}
src={picture}
/>
{avatar}
</Col>
</Row>
<SocialIcons