badge.jsx 947 B

12345678910111213141516171819202122232425262728293031323334
  1. import PropTypes from 'prop-types';
  2. import { FormattedMessage } from 'react-intl';
  3. import GroupsIcon from '@/material-icons/400-24px/group.svg?react';
  4. import PersonIcon from '@/material-icons/400-24px/person.svg?react';
  5. import SmartToyIcon from '@/material-icons/400-24px/smart_toy.svg?react';
  6. export const Badge = ({ icon, label, domain }) => (
  7. <div className='account-role'>
  8. {icon}
  9. {label}
  10. {domain && <span className='account-role__domain'>{domain}</span>}
  11. </div>
  12. );
  13. Badge.propTypes = {
  14. icon: PropTypes.node,
  15. label: PropTypes.node,
  16. domain: PropTypes.node,
  17. };
  18. Badge.defaultProps = {
  19. icon: <PersonIcon />,
  20. };
  21. export const GroupBadge = () => (
  22. <Badge icon={<GroupsIcon />} label={<FormattedMessage id='account.badges.group' defaultMessage='Group' />} />
  23. );
  24. export const AutomatedBadge = () => (
  25. <Badge icon={<SmartToyIcon />} label={<FormattedMessage id='account.badges.bot' defaultMessage='Automated' />} />
  26. );