All files / report/components/MultiProfileLegends index.jsx

50% Statements 4/8
100% Branches 0/0
0% Functions 0/3
50% Lines 4/8
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          1x           1x                       1x         1x          
import React from 'react';
import PropTypes from 'prop-types';
import styled from 'styled-components';
import ProfileLegend from '../ProfileLegend';
 
const Container = styled.div`
  padding: 0 0.5rem 0 0;
  display: flex;
  justify-content: flex-start;
`;
 
const MultiProfileLegends = ({ profiles, comparedProfileIds }) => {
  const comparedProfiles = profiles.filter(profile => (
    comparedProfileIds.includes(profile.id)
  ));
 
  return (
    <Container>
      {comparedProfiles.map(profile => <ProfileLegend profile={profile} />)}
    </Container>
  );
};
 
MultiProfileLegends.propTypes = {
  profiles: PropTypes.arrayOf(PropTypes.object).isRequired,
  comparedProfileIds: PropTypes.arrayOf(PropTypes.number),
};
 
MultiProfileLegends.defaultProps = {
  comparedProfileIds: [],
};
 
export default MultiProfileLegends;