You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

DisplayNameBadge.tsx 948B

123456789101112131415161718192021222324252627282930313233343536373839
  1. import React from 'react';
  2. import { makeStyles } from 'tss-react/mui';
  3. import { DISPLAY_NAME_VERTICAL_PADDING } from './styles';
  4. const useStyles = makeStyles()(theme => {
  5. const { text01 } = theme.palette;
  6. return {
  7. badge: {
  8. background: 'rgba(0, 0, 0, 0.6)',
  9. borderRadius: '3px',
  10. color: text01,
  11. maxWidth: '50%',
  12. overflow: 'hidden',
  13. padding: `${DISPLAY_NAME_VERTICAL_PADDING / 2}px 16px`,
  14. textOverflow: 'ellipsis',
  15. whiteSpace: 'nowrap'
  16. }
  17. };
  18. });
  19. /**
  20. * Component that displays a name badge.
  21. *
  22. * @param {Props} props - The props of the component.
  23. * @returns {ReactElement}
  24. */
  25. const DisplayNameBadge: React.FC<{ name: string; }> = ({ name }) => {
  26. const { classes } = useStyles();
  27. return (
  28. <div className = { classes.badge }>
  29. { name }
  30. </div>
  31. );
  32. };
  33. export default DisplayNameBadge;