react-icons/bi#BiVolumeFull TypeScript Examples

The following examples show how to use react-icons/bi#BiVolumeFull. 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: Player.tsx    From Intro_to_React with GNU General Public License v2.0 5 votes vote down vote up
Player: React.FC<{
  songInfo: song
  state: HTMLMediaState
  controls: HTMLMediaControls
  audio: HTMLAudioElement | null
}> = ({ songInfo, state, controls, audio }) => {
  const toggle = () => {
    if (state.paused) controls.play()
    else controls.pause()
  }

  const { time, duration } = state

  const percentage = time === 0 && duration === 0 ? 0 : (time / duration) * 100

  return (
    <footer className={styles.player}>
      <div className={styles.time} style={{ width: percentage + "%" }}></div>
      <div className={styles.container}>
        <div className={styles.info}>
          <div className={styles.album}>{songInfo?.albumName}</div>
          <div className={styles.song}>{songInfo?.songName}</div>
        </div>
        <div className={styles.playing} onClick={toggle}>
          {state.paused ? <BiPlay /> : <BiPause />}
        </div>
        <div className={styles.controls}>
          <div
            onClick={() => {
              if (state.muted) controls.unmute()
              else controls.mute()
            }}
          >
            {state.muted ? <BiVolumeMute /> : <BiVolumeFull />}
          </div>
          <div>
            <input
              min="0"
              max="1"
              step="0.01"
              value={state.volume}
              type="range"
              onChange={e => {
                controls.volume(+e.target.value)
              }}
            />
          </div>
        </div>
      </div>
    </footer>
  )
}
Example #2
Source File: Player.tsx    From Intro_to_React with GNU General Public License v2.0 5 votes vote down vote up
Player: React.FC<{
  songInfo: song
  state: HTMLMediaState
  controls: HTMLMediaControls
  audio: HTMLAudioElement | null
}> = ({ songInfo, state, controls, audio }) => {
  const toggle = () => {
    if (state.paused) controls.play()
    else controls.pause()
  }

  const { time, duration } = state

  const percentage = time === 0 && duration === 0 ? 0 : (time / duration) * 100

  return (
    <footer className={styles.player}>
      <div className={styles.time} style={{ width: percentage + "%" }}></div>
      <div className={styles.container}>
        <div className={styles.info}>
          <div className={styles.album}>{songInfo?.albumName}</div>
          <div className={styles.song}>{songInfo?.songName}</div>
        </div>
        <div className={styles.playing} onClick={toggle}>
          {audio?.readyState ? state.paused ? <BiPlay /> : <BiPause /> : <BiLoader className={styles.loading} />}
        </div>
        <div className={styles.controls}>
          <div
            onClick={() => {
              if (state.muted) controls.unmute()
              else controls.mute()
            }}
          >
            {state.muted ? <BiVolumeMute /> : <BiVolumeFull />}
          </div>
          <div>
            <input
              min="0"
              max="1"
              step="0.01"
              value={state.volume}
              type="range"
              onChange={e => {
                controls.volume(+e.target.value)
              }}
            />
          </div>
        </div>
      </div>
    </footer>
  )
}