Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

ParticipantPaneBaseButton.js 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. // @flow
  2. import { makeStyles } from '@material-ui/styles';
  3. import React from 'react';
  4. import participantsPaneTheme from '../../../base/components/themes/participantsPaneTheme.json';
  5. type Props = {
  6. /**
  7. * Label used for accessibility.
  8. */
  9. accessibilityLabel: String,
  10. /**
  11. * Additional class name for custom styles.
  12. */
  13. className?: string,
  14. /**
  15. * Children of the component.
  16. */
  17. children: string | React$Node,
  18. /**
  19. * Button id.
  20. */
  21. id?: string,
  22. /**
  23. * Click handler.
  24. */
  25. onClick: Function,
  26. /**
  27. * Whether or not the button should have primary button style.
  28. */
  29. primary?: boolean
  30. }
  31. const useStyles = makeStyles(theme => {
  32. return {
  33. button: {
  34. alignItems: 'center',
  35. backgroundColor: theme.palette.ui03,
  36. border: 0,
  37. borderRadius: `${theme.shape.borderRadius}px`,
  38. display: 'flex',
  39. justifyContent: 'center',
  40. minHeight: '40px',
  41. padding: `${theme.spacing(2)}px ${theme.spacing(3)}px`,
  42. ...theme.typography.labelButton,
  43. lineHeight: `${theme.typography.labelButton.lineHeight}px`,
  44. '&:hover': {
  45. backgroundColor: theme.palette.ui04
  46. },
  47. [`@media (max-width: ${participantsPaneTheme.MD_BREAKPOINT})`]: {
  48. ...theme.typography.labelButtonLarge,
  49. lineHeight: `${theme.typography.labelButtonLarge.lineHeight}px`,
  50. minWidth: '48px',
  51. minHeight: '48px'
  52. }
  53. },
  54. buttonPrimary: {
  55. backgroundColor: theme.palette.action01,
  56. '&:hover': {
  57. backgroundColor: theme.palette.action01Hover
  58. }
  59. }
  60. };
  61. });
  62. const ParticipantPaneBaseButton = ({
  63. accessibilityLabel,
  64. className,
  65. children,
  66. id,
  67. onClick,
  68. primary = false
  69. }: Props) => {
  70. const styles = useStyles();
  71. return (
  72. <button
  73. aria-label = { accessibilityLabel }
  74. className = { `${styles.button} ${primary ? styles.buttonPrimary : ''} ${className ?? ''}` }
  75. id = { id }
  76. onClick = { onClick }>
  77. {children}
  78. </button>
  79. );
  80. };
  81. export default ParticipantPaneBaseButton;