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 926B

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