RecordButton.tsx 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /* eslint-disable @typescript-eslint/explicit-module-boundary-types */
  2. import { h } from 'preact'
  3. type $TSFixMe = any
  4. /**
  5. * Control screen capture recording. Will show record or stop button.
  6. */
  7. export default function RecordButton({
  8. recording,
  9. onStartRecording,
  10. onStopRecording,
  11. i18n,
  12. }: $TSFixMe) {
  13. if (recording) {
  14. return (
  15. <button
  16. className="uppy-u-reset uppy-c-btn uppy-ScreenCapture-button uppy-ScreenCapture-button--video uppy-ScreenCapture-button--stop-rec"
  17. type="button"
  18. title={i18n('stopCapturing')}
  19. aria-label={i18n('stopCapturing')}
  20. onClick={onStopRecording}
  21. data-uppy-super-focusable
  22. >
  23. <svg
  24. aria-hidden="true"
  25. focusable="false"
  26. className="uppy-c-icon"
  27. width="100"
  28. height="100"
  29. viewBox="0 0 100 100"
  30. >
  31. <rect x="15" y="15" width="70" height="70" />
  32. </svg>
  33. </button>
  34. )
  35. }
  36. return (
  37. <button
  38. className="uppy-u-reset uppy-c-btn uppy-ScreenCapture-button uppy-ScreenCapture-button--video"
  39. type="button"
  40. title={i18n('startCapturing')}
  41. aria-label={i18n('startCapturing')}
  42. onClick={onStartRecording}
  43. data-uppy-super-focusable
  44. >
  45. <svg
  46. aria-hidden="true"
  47. focusable="false"
  48. className="uppy-c-icon"
  49. width="100"
  50. height="100"
  51. viewBox="0 0 100 100"
  52. >
  53. <circle cx="50" cy="50" r="40" />
  54. </svg>
  55. </button>
  56. )
  57. }