@material-ui/icons#PlayArrow JavaScript Examples
The following examples show how to use
@material-ui/icons#PlayArrow.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: StartButton.js From budgie-stream with MIT License | 6 votes |
export default function StartButton() {
const classes = useStyles();
const { playback } = useContext(ClientContext);
const [state, setState] = playback;
const devices = state.devices.filter((device) => device.selected === true);
const disabled = !!!devices.length;
const handleButtonClick = () => {
togglePlay(devices, !state.playing);
setState((prevState) => ({
...prevState,
playing: !prevState.playing,
}));
};
return (
<div className={classes.root}>
<Fab
disabled={disabled}
style={{ color: "#5e81ac" }}
onClick={handleButtonClick}
>
{state.playing ? <Stop /> : <PlayArrow />}
</Fab>
</div>
);
}
Example #2
Source File: MusicCardSpan.jsx From soundly with MIT License | 6 votes |
function MusicCardSpan({ music }) {
return (
<div style={{ cursor: "pointer" }} className={"MusicCardSpan"}>
<div className={"d1"}>
<img src={require("../assets/img/" + music.img)} alt="" />
<div className="detail">
<h4>{music.name}</h4>
<p>{music.author_name}</p>
</div>
</div>
<div className="play">
<PlayArrow fontSize={"large"} />
</div>
</div>
);
}
Example #3
Source File: component.js From Queen with MIT License | 4 votes |
Buttons = ({ rereading, setPendingChangePage }) => {
const { readonly, page, isFirstPage, isLastPage } = useContext(OrchestratorContext);
const classes = useStyles();
const previousButtonRef = useRef();
const nextButtonRef = useRef();
const fastNextButtonRef = useRef();
const returnLabel = isFirstPage ? '' : D.goBackReturn;
const keysToHandle = ['alt+enter', 'alt+backspace', 'alt+end'];
const [focusPrevious, setFocusPrevious] = useState(false);
const [focusNext, setFocusNext] = useState(false);
const [focusFastForward, setFocusFastForward] = useState(false);
const onfocusPrevious = value => () => setFocusPrevious(value);
const onfocusNext = value => () => setFocusNext(value);
const onfocusFastForward = value => () => setFocusFastForward(value);
const [pageChanging, setPageChanging] = useState(false);
const localPagePrevious = () => setPageChanging('previous');
const localPageNext = () => setPageChanging('next');
const localPageFastForward = () => setPageChanging('fastForward');
useEffect(() => {
setPageChanging(false);
}, [page]);
const keyboardShortcut = (key, e) => {
e.preventDefault();
if (key === 'alt+enter' && ((!isLastPage && rereading) || readonly)) {
if (nextButtonRef && nextButtonRef.current) {
nextButtonRef.current.focus();
localPageNext();
}
}
if (key === 'alt+backspace' && !isFirstPage) {
if (previousButtonRef && previousButtonRef.current) {
previousButtonRef.current.focus();
localPagePrevious();
}
}
if (key === 'alt+end' && !readonly && rereading && !isLastPage) {
if (fastNextButtonRef && fastNextButtonRef.current) {
fastNextButtonRef.current.focus();
localPageFastForward();
}
}
};
useEffect(() => {
if ((focusNext || focusFastForward || focusPrevious) && pageChanging) {
setPendingChangePage(pageChanging);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [pageChanging, setPendingChangePage]);
return (
<>
<div id="buttons" className={classes.root}>
{returnLabel && (
<div className={classes.navigation}>
<IconButton
ref={previousButtonRef}
ariaLabel={D.goBackReturnLabel}
className={classes.previousIcon}
type="button"
onClick={localPagePrevious}
onFocus={onfocusPrevious(true)}
onBlur={onfocusPrevious(false)}
>
<PlayArrow fontSize="small" />
</IconButton>
<span className={classes.shortButtonSpan}>{D.goBackReturn}</span>
</div>
)}
{((readonly && !isLastPage) || (!isLastPage && rereading)) && (
<div className={`${classes.navigation} ${classes.nextButton}`}>
<IconButton
ref={nextButtonRef}
ariaLabel={D.nextButtonLabel}
type="button"
onClick={localPageNext}
onFocus={onfocusNext(true)}
onBlur={onfocusNext(false)}
>
<PlayArrow fontSize="small" />
</IconButton>
<span className={classes.shortButtonSpan}>{D.nextButton}</span>
</div>
)}
{!readonly && rereading && !isLastPage && (
<div className={`${classes.navigation} ${classes.fastButtonWrapper}`}>
<Button
ref={fastNextButtonRef}
className={classes.fastButton}
type="button"
endIcon={skipNextIcon}
onClick={localPageFastForward}
onFocus={onfocusFastForward(true)}
onBlur={onfocusFastForward(false)}
>
{`${D.fastForward}`}
</Button>
<span className={classes.fastButtonSpan}>
<b>{D.ctrlEnd}</b>
</span>
</div>
)}
</div>
<KeyboardEventHandler
handleKeys={keysToHandle}
onKeyEvent={keyboardShortcut}
handleFocusableElements
/>
</>
);
}