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.js 922B

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