~cytrogen/masto-fe

ref: f8dc013b0d81d5d463c086e291ce99ab1d796a9d masto-fe/app/javascript/mastodon/components/badge.jsx -rw-r--r-- 1.0 KiB
f8dc013b — Cytrogen [feature] Add language selector to local settings 4 days ago
                                                                                
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
import PropTypes from "prop-types";

import { FormattedMessage } from "react-intl";

import { ReactComponent as GroupsIcon } from "@material-design-icons/svg/outlined/group.svg";
import { ReactComponent as PersonIcon } from "@material-design-icons/svg/outlined/person.svg";
import { ReactComponent as SmartToyIcon } from "@material-design-icons/svg/outlined/smart_toy.svg";


export const Badge = ({ icon, label, domain }) => (
  <div className='account-role'>
    {icon}
    {label}
    {domain && <span className='account-role__domain'>{domain}</span>}
  </div>
);

Badge.propTypes = {
  icon: PropTypes.node,
  label: PropTypes.node,
  domain: PropTypes.node,
};

Badge.defaultProps = {
  icon: <PersonIcon />,
};

export const GroupBadge = () => (
  <Badge icon={<GroupsIcon />} label={<FormattedMessage id='account.badges.group' defaultMessage='Group' />} />
);

export const AutomatedBadge = () => (
  <Badge icon={<SmartToyIcon />} label={<FormattedMessage id='account.badges.bot' defaultMessage='Automated' />} />
);