视频播放器仓库

PlayPause.js 902B

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