您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

DisplayNameBadge.tsx 902B

1234567891011121314151617181920212223242526272829303132333435363738
  1. import { Theme } from '@mui/material';
  2. import React from 'react';
  3. import { makeStyles } from 'tss-react/mui';
  4. const useStyles = makeStyles()((theme: 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: '2px 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;