All files / report/components/ProfileLegend index.jsx

83.33% Statements 5/6
100% Branches 0/0
0% Functions 0/1
83.33% Lines 5/6
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44            1x       1x           1x       1x                             1x                
import React from 'react';
import PropTypes from 'prop-types';
import styled from 'styled-components';
import { Text } from '@bufferapp/components';
import { ProfileBadge } from '@bufferapp/analyze-shared-components';
 
const Profile = styled.span`
  position: relative;
`;
 
const Legend = styled.span`
  display: flex;
  align-items: center;
  margin: 0 1.25rem 0.5rem 0;
`;
 
const ProfileText = styled.div`
  margin: -1px 0 0 -4px
`;
 
const ProfileLegend = ({ profile }) =>
  <Legend>
    <ProfileBadge
      avatarUrl={profile.avatarUrl}
      service={profile.service}
      avatarSize={16}
      socialIconSize={18}
    />
    <ProfileText>
      <Text color="outerSpace" weight="medium" size="small">
        <Profile>{profile.username}</Profile>
      </Text>
    </ProfileText>
  </Legend>;
 
ProfileLegend.propTypes = {
  profile: PropTypes.shape({
    service: PropTypes.string,
    username: PropTypes.string,
  }).isRequired,
};
 
export default ProfileLegend;