implemented mute functionality
This commit is contained in:
@@ -1,10 +1,14 @@
|
|||||||
import React from 'react'
|
import React, { useState } from 'react'
|
||||||
|
|
||||||
import PlayLogo from '../static/images/play-button.svg'
|
import PlayLogo from '../static/images/play-button.svg'
|
||||||
import AddLogo from '../static/images/add.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'
|
import ReactPlayer from 'react-player'
|
||||||
|
|
||||||
const Header = ({ movie: { backdrop_path, name, overview } }) => {
|
const Header = ({ movie: { name, overview } }) => {
|
||||||
|
const [isMuted, setIsMuted] = useState(false)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<header className='header'>
|
<header className='header'>
|
||||||
<ReactPlayer
|
<ReactPlayer
|
||||||
@@ -12,6 +16,8 @@ const Header = ({ movie: { backdrop_path, name, overview } }) => {
|
|||||||
loop={true}
|
loop={true}
|
||||||
width='100%'
|
width='100%'
|
||||||
height='100%'
|
height='100%'
|
||||||
|
volume={1}
|
||||||
|
muted={isMuted}
|
||||||
className='header__video'
|
className='header__video'
|
||||||
url='https://vimeo.com/384025132'
|
url='https://vimeo.com/384025132'
|
||||||
/>
|
/>
|
||||||
@@ -27,6 +33,18 @@ const Header = ({ movie: { backdrop_path, name, overview } }) => {
|
|||||||
<AddLogo className='header__container-btnMyList-add' />
|
<AddLogo className='header__container-btnMyList-add' />
|
||||||
My List
|
My List
|
||||||
</button>
|
</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>
|
<p className='header__container-overview'>{overview}</p>
|
||||||
<div className='header__container--fadeBottom'></div>
|
<div className='header__container--fadeBottom'></div>
|
||||||
</header>
|
</header>
|
||||||
|
|||||||
3
src/static/images/mute.svg
Normal file
3
src/static/images/mute.svg
Normal 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 |
3
src/static/images/unmute.svg
Normal file
3
src/static/images/unmute.svg
Normal 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 |
@@ -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 {
|
&-overview {
|
||||||
top: 28rem;
|
top: 28rem;
|
||||||
left: 4rem;
|
left: 4rem;
|
||||||
|
|||||||
Reference in New Issue
Block a user