implemented mute functionality

This commit is contained in:
andres alcocer
2021-10-09 15:14:12 -04:00
parent 4074b76af3
commit 4ba996f865
4 changed files with 49 additions and 2 deletions

View File

@@ -1,10 +1,14 @@
import React from 'react'
import React, { useState } from 'react'
import PlayLogo from '../static/images/play-button.svg'
import AddLogo from '../static/images/add.svg'
import MuteIcon from '../static/images/mute.svg'
import UnmuteIcon from '../static/images/unmute.svg'
import ReactPlayer from 'react-player'
const Header = ({ movie: { backdrop_path, name, overview } }) => {
const Header = ({ movie: { name, overview } }) => {
const [isMuted, setIsMuted] = useState(false)
return (
<header className='header'>
<ReactPlayer
@@ -12,6 +16,8 @@ const Header = ({ movie: { backdrop_path, name, overview } }) => {
loop={true}
width='100%'
height='100%'
volume={1}
muted={isMuted}
className='header__video'
url='https://vimeo.com/384025132'
/>
@@ -27,6 +33,18 @@ const Header = ({ movie: { backdrop_path, name, overview } }) => {
<AddLogo className='header__container-btnMyList-add' />
My List
</button>
{isMuted ? (
<MuteIcon
onClick={() => setIsMuted(false)}
className='header__container-btnVolume'
/>
) : (
<UnmuteIcon
onClick={() => setIsMuted(true)}
className='header__container-btnVolume'
/>
)}
<p className='header__container-overview'>{overview}</p>
<div className='header__container--fadeBottom'></div>
</header>

View File

@@ -0,0 +1,3 @@
<svg width="24px" height="24px" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path fill="none" stroke="#000" stroke-width="2" d="M1,8 L1,16 L6.09901951,16 L12,21 L12,3 L6,8 L1,8 Z M15,9 L21,15 M21,9 L15,15"/>
</svg>

After

Width:  |  Height:  |  Size: 229 B

View File

@@ -0,0 +1,3 @@
<svg width="24px" height="24px" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path fill="none" stroke="#000" stroke-width="2" d="M15,16 C17.209,16 19,14.209 19,12 C19,9.791 17.209,8 15,8 M15,20 C20,20 23,16.411 23,12 C23,7.589 19.411,4 15,4 M1,12 L1,8 L6,8 L12,3 L12,21 L6,16 L1,16 L1,12"/>
</svg>

After

Width:  |  Height:  |  Size: 311 B

View File

@@ -85,6 +85,29 @@
}
}
&-btnVolume {
position: absolute;
height: 3rem;
width: 3rem;
top: 45rem;
right: 14rem;
cursor: pointer;
border-radius: 50%;
padding: 1rem;
border: #fff solid 1px;
transition: all 0.3s;
& > * {
stroke: #fff;
stroke-width: 1;
}
&:hover {
background-color: rgba(211, 211, 211, 0.178);
transition: all 0.3s;
}
}
&-overview {
top: 28rem;
left: 4rem;