视频播放器仓库

PlayPause.js 732B

123456789101112131415161718192021222324252627282930
  1. import React from "react";
  2. import styles from "./PlayPause.module.css";
  3. import { ReactComponent as PlayArrow } from "../Icon/play_arrow.svg";
  4. import { ReactComponent as Pause } from "../Icon/pause.svg";
  5. export default ({
  6. onClick,
  7. paused,
  8. className,
  9. ariaLabelPlay,
  10. ariaLabelPause
  11. }) => {
  12. return (
  13. <div className={[styles.component, className].join(" ")}>
  14. <button
  15. className={styles.button}
  16. onClick={onClick}
  17. aria-label={paused ? ariaLabelPlay : ariaLabelPause}
  18. type="button"
  19. >
  20. {paused ? (
  21. <PlayArrow className={styles.icon} fill="#fff" />
  22. ) : (
  23. <Pause className={styles.icon} fill="#fff" />
  24. )}
  25. </button>
  26. </div>
  27. );
  28. };