diff --git a/app/javascript/flavours/glitch/components/badge.jsx b/app/javascript/flavours/glitch/components/badge.jsx new file mode 100644 index 0000000000..cf225a6a0c --- /dev/null +++ b/app/javascript/flavours/glitch/components/badge.jsx @@ -0,0 +1,34 @@ +import PropTypes from 'prop-types'; + +import { FormattedMessage } from 'react-intl'; + +import { ReactComponent as GroupsIcon } from '@material-symbols/svg-600/outlined/group.svg'; +import { ReactComponent as PersonIcon } from '@material-symbols/svg-600/outlined/person.svg'; +import { ReactComponent as SmartToyIcon } from '@material-symbols/svg-600/outlined/smart_toy.svg'; + + +export const Badge = ({ icon, label, domain }) => ( +
+ {icon} + {label} + {domain && {domain}} +
+); + +Badge.propTypes = { + icon: PropTypes.node, + label: PropTypes.node, + domain: PropTypes.node, +}; + +Badge.defaultProps = { + icon: , +}; + +export const GroupBadge = () => ( + } label={} /> +); + +export const AutomatedBadge = () => ( + } label={} /> +); diff --git a/app/javascript/flavours/glitch/features/account/components/header.jsx b/app/javascript/flavours/glitch/features/account/components/header.jsx index 6943cbd170..1da9cb4411 100644 --- a/app/javascript/flavours/glitch/features/account/components/header.jsx +++ b/app/javascript/flavours/glitch/features/account/components/header.jsx @@ -10,6 +10,7 @@ import ImmutablePropTypes from 'react-immutable-proptypes'; import ImmutablePureComponent from 'react-immutable-pure-component'; import { Avatar } from 'flavours/glitch/components/avatar'; +import { Badge, AutomatedBadge, GroupBadge } from 'flavours/glitch/components/badge'; import { Button } from 'flavours/glitch/components/button'; import { Icon } from 'flavours/glitch/components/icon'; import { IconButton } from 'flavours/glitch/components/icon_button'; @@ -311,28 +312,13 @@ class Header extends ImmutablePureComponent { const badges = []; if (account.get('bot')) { - badges.push( -
- { ' ' } - -
- ); + badges.push(); } else if (account.get('group')) { - badges.push( -
- { ' ' } - -
- ); + badges.push(); } account.get('roles', []).forEach((role) => { - badges.push( -
- { ' ' } - {role.get('name')} ({domain}) -
- ); + badges.push({role.get('name')}} domain={domain} />); }); return ( diff --git a/app/javascript/flavours/glitch/styles/accounts.scss b/app/javascript/flavours/glitch/styles/accounts.scss index 54d0d60a6f..f31be33058 100644 --- a/app/javascript/flavours/glitch/styles/accounts.scss +++ b/app/javascript/flavours/glitch/styles/accounts.scss @@ -191,7 +191,6 @@ } } -.account-role, .information-badge, .simple_form .overridden, .simple_form .recommended, @@ -218,10 +217,30 @@ } .account-role { + display: inline-flex; + padding: 4px; + padding-inline-end: 8px; border: 1px solid $highlight-text-color; + color: $highlight-text-color; + font-weight: 500; + font-size: 12px; + letter-spacing: 0.5px; + line-height: 16px; + gap: 4px; + border-radius: 6px; + align-items: center; - .fa { - color: var(--user-role-accent, $highlight-text-color); + svg { + width: auto; + height: 15px; + opacity: 0.85; + fill: currentColor; + } + + &__domain { + font-weight: 400; + opacity: 0.75; + letter-spacing: 0; } }