diff --git a/src/components/AudioRecordingComponent.tsx b/src/components/AudioRecordingComponent.tsx index 8b376d38..b0493085 100644 --- a/src/components/AudioRecordingComponent.tsx +++ b/src/components/AudioRecordingComponent.tsx @@ -6,7 +6,7 @@ import micSVG from "../icons/mic.svg"; import pauseSVG from "../icons/pause.svg"; import resumeSVG from "../icons/play.svg"; import saveSVG from "../icons/save.svg"; -import discardSVG from "../icons/stop.svg"; +import discardSVG from "../icons/trash.svg"; import "../styles/audio-recorder.css"; const LiveAudioVisualizer = React.lazy(async () => { @@ -66,6 +66,14 @@ const AudioRecorder: (props: Props) => ReactElement = ({ stopRecording(); }; + const startAudioRecorder: React.MouseEventHandler = ( + event + ) => { + startRecording(); + const target = event.target as HTMLElement; + target?.focus(); + }; + const convertToDownloadFileExtension = async ( webmBlob: Blob ): Promise => { @@ -134,19 +142,30 @@ const AudioRecorder: (props: Props) => ReactElement = ({ }`} data-testid="audio_recorder" > - stopAudioRecorder() : startRecording} data-testid="ar_mic" + aria-label={isRecording ? "Save recording" : "Start recording"} title={isRecording ? "Save recording" : "Start recording"} - /> + onClick={isRecording ? () => stopAudioRecorder() : startAudioRecorder} + > + {isRecording + {showVisualizer ? ( ) : ( )} - - + {isPaused + + ); }; diff --git a/src/icons/trash.svg b/src/icons/trash.svg new file mode 100644 index 00000000..436ac85f --- /dev/null +++ b/src/icons/trash.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/styles/audio-recorder.css b/src/styles/audio-recorder.css index 42d51bcb..5c92a548 100644 --- a/src/styles/audio-recorder.css +++ b/src/styles/audio-recorder.css @@ -14,16 +14,23 @@ -webkit-tap-highlight-color: transparent; } -.audio-recorder-mic { +.audio-recorder button { box-sizing: content-box; - cursor: pointer; - height: 16px; + background: transparent; + border: none; color: black; + cursor: pointer; + margin: 0; padding: 12px; } +.audio-recorder img { + aspect-ratio: 1/1; + display: block; +} + .audio-recorder .audio-recorder-mic { - border-radius: 20px; + border-radius: 50%; } .audio-recorder.recording .audio-recorder-mic { @@ -57,24 +64,15 @@ margin-right: 5px; } -.audio-recorder-options { - box-sizing: content-box; - height: 16px; - cursor: pointer; - padding: 12px 6px 12px 12px; -} -.audio-recorder-options ~ .audio-recorder-options { - padding: 12px 12px 12px 6px; - border-radius: 0 5px 5px 0; -} - .recording { border-radius: 12px; - width: 300px; + padding-inline: 10px; + width: 320px; + width: min-content; transition: all 0.2s ease-out; } -.display-none { +.audio-recorder [hidden] { display: none; }