Skip to content

Commit

Permalink
docs: minor cleanup on mui nextjs react hooks example components.
Browse files Browse the repository at this point in the history
  • Loading branch information
cjpillsbury committed Apr 11, 2024
1 parent c069e11 commit 5e1ddfb
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,25 @@ const AudioMenuButton = () => {
(state) => state.mediaAudioTrackEnabled
);

const label = open ? 'close audio tracks menu' : 'select audio track';

return (
<>
<IconButton
id="renditions"
aria-controls={open ? 'close renditions' : 'select rendition'}
aria-haspopup="true"
aria-expanded={open ? 'true' : undefined}
color="primary"
onClick={handleClick}
>
<TuneIcon />
</IconButton>
<Tooltip title={label} placement="top">
<IconButton
id="audio-tracks"
aria-controls={label}
aria-haspopup="true"
aria-expanded={open ? 'true' : undefined}
color="primary"
onClick={handleClick}
>
<TuneIcon />
</IconButton>
</Tooltip>
<Menu
id="renditions"
aria-labelledby="renditions"
id="audio-tracks"
aria-labelledby="subtitles"
anchorEl={anchorEl}
open={open}
onClose={handleClose}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,25 @@ const CaptionsMenuButton = () => {
);
const subtitlesOff = !mediaSubtitlesShowing?.length;

const label = open ? 'close subtitles menu' : 'select subtitles';

return (
<>
<IconButton
id="playback-rate"
aria-controls={open ? 'close playback rate' : 'select playback rate'}
aria-haspopup="true"
aria-expanded={open ? 'true' : undefined}
color="primary"
onClick={handleClick}
>
{subtitlesOff ? <ClosedCaptionDisabledIcon /> : <ClosedCaptionIcon />}
</IconButton>
<Tooltip title={label} placement="top">
<IconButton
id="subtitles"
aria-controls={label}
aria-haspopup="true"
aria-expanded={open ? 'true' : undefined}
color="primary"
onClick={handleClick}
>
{subtitlesOff ? <ClosedCaptionDisabledIcon /> : <ClosedCaptionIcon />}
</IconButton>
</Tooltip>
<Menu
id="playback-rate"
aria-labelledby="playback-rate"
id="subtitles"
aria-labelledby="subtitles"
anchorEl={anchorEl}
open={open}
onClose={handleClose}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { Box, Stack } from '@mui/material';
import {
useMediaDispatch,
useMediaSelector,
} from 'media-chrome/react/media-store';
import { useMediaSelector } from 'media-chrome/react/media-store';
import CurrentTimeDisplay from './CurrentTimeDisplay';
import Seekbar from './Seekbar';
import DurationDisplay from './DurationDisplay';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,22 @@ const RenditionsMenuButton = () => {
(state) => state.mediaRenditionSelected
);

const label = open ? 'close renditions menu' : 'select rendition';

return (
<>
<IconButton
id="renditions"
aria-controls={open ? 'close renditions' : 'select rendition'}
aria-haspopup="true"
aria-expanded={open ? 'true' : undefined}
color="primary"
onClick={handleClick}
>
<GraphicEqIcon />
</IconButton>
<Tooltip title={label} placement="top">
<IconButton
id="renditions"
aria-controls={label}
aria-haspopup="true"
aria-expanded={open ? 'true' : undefined}
color="primary"
onClick={handleClick}
>
<GraphicEqIcon />
</IconButton>
</Tooltip>
<Menu
id="renditions"
aria-labelledby="renditions"
Expand Down

0 comments on commit 5e1ddfb

Please sign in to comment.