diff --git a/dotcom-rendering/package.json b/dotcom-rendering/package.json index e24753777a6..bc242c80a88 100644 --- a/dotcom-rendering/package.json +++ b/dotcom-rendering/package.json @@ -190,7 +190,6 @@ "typescript-json-schema": "0.64.0", "unified": "11.0.5", "valibot": "0.28.1", - "wavesurfer.js": "7.8.6", "web-vitals": "4.2.3", "webpack": "5.94.0", "webpack-assets-manifest": "5.2.1", diff --git a/dotcom-rendering/src/components/AudioPlayer/AudioPlayer.tsx b/dotcom-rendering/src/components/AudioPlayer/AudioPlayer.tsx index dbbb99bed5d..d84d58ae7cf 100644 --- a/dotcom-rendering/src/components/AudioPlayer/AudioPlayer.tsx +++ b/dotcom-rendering/src/components/AudioPlayer/AudioPlayer.tsx @@ -1,281 +1,12 @@ -import { css } from '@emotion/react'; -import { isUndefined, log } from '@guardian/libs'; -import { from, palette, textSans15 } from '@guardian/source/foundations'; -import { - SvgAudio, - SvgAudioMute, - SvgMediaControlsBack, - SvgMediaControlsForward, - SvgMediaControlsPause, - SvgMediaControlsPlay, -} from '@guardian/source/react-components'; -import { forwardRef, useEffect, useRef, useState } from 'react'; -import WaveSurfer from 'wavesurfer.js'; -import { formatTime } from '../../lib/formatTime'; - -// default base styling for all buttons -const buttonBaseCss = css` - display: inline-flex; - align-items: center; - justify-content: center; - background: none; - border: 0; - margin: 0; - padding: 0; - - :focus { - outline: none; - } - - :not(:disabled):hover { - opacity: 0.8; - cursor: pointer; - } -`; - -// ****************** Wrapper/grid etc ****************** - -const Wrapper = ({ - showVolumeControls, - ...props -}: { showVolumeControls: boolean } & React.ComponentPropsWithoutRef<'div'>) => ( -
-); - -// ****************** Time Display ****************** - -const timeCSS = css` - padding-top: 4px; - display: flex; - align-items: center; - justify-content: center; - ${textSans15}; - color: ${palette.neutral[86]}; - background-color: ${palette.neutral[20]}; - z-index: 1; - - ${from.leftCol} { - padding-top: 0; - } -`; - -const CurrentTime = ({ time }: { time: number }) => ( - -); - -const Duration = ({ time }: { time: number }) => ( - -); - -// ****************** Progress bar/waveform ****************** - -const WaveForm = forwardRef< - HTMLDivElement, - React.ComponentPropsWithoutRef<'div'> & { progress: number } ->(({ progress, ...props }, ref) => ( -
-)); - -// ****************** Playback Controls ****************** - -const PlayButton = ({ - isReady, - ...props -}: { isReady: boolean } & React.ComponentPropsWithoutRef<'button'>) => { - return ( - + ); +}; + +Playback.SkipBack = (props: Pick) => ( + + + +); + +Playback.SkipForward = (props: Pick) => ( + + + +); diff --git a/dotcom-rendering/src/components/AudioPlayer/components/ProgressBar.tsx b/dotcom-rendering/src/components/AudioPlayer/components/ProgressBar.tsx new file mode 100644 index 00000000000..1ec08ffde4a --- /dev/null +++ b/dotcom-rendering/src/components/AudioPlayer/components/ProgressBar.tsx @@ -0,0 +1,41 @@ +import { css } from '@emotion/react'; +import { from, palette } from '@guardian/source/foundations'; + +const cursorWidth = '4px'; + +export const ProgressBar = ({ + progress, + ...props +}: React.ComponentPropsWithoutRef<'div'> & { progress: number }) => ( +
+
+
+); diff --git a/dotcom-rendering/src/components/AudioPlayer/components/Volume.tsx b/dotcom-rendering/src/components/AudioPlayer/components/Volume.tsx new file mode 100644 index 00000000000..cd086ee59e9 --- /dev/null +++ b/dotcom-rendering/src/components/AudioPlayer/components/Volume.tsx @@ -0,0 +1,85 @@ +import { css } from '@emotion/react'; +import { from, palette } from '@guardian/source/foundations'; +import { SvgAudio } from '@guardian/source/react-components'; +import { buttonBaseCss } from '../styles'; + +type ButtonProps = React.ComponentPropsWithoutRef<'button'>; + +const Control = (props: ButtonProps) => { + return ( +