convert external-video-player volume-slider component

This commit is contained in:
Ramón Souza 2021-11-03 17:06:33 +00:00
parent 0eea1e7cea
commit c3bdbcc7b0
2 changed files with 24 additions and 38 deletions

View File

@ -1,5 +1,5 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { styles } from './styles'; import Styled from './styles';
class VolumeSlider extends Component { class VolumeSlider extends Component {
constructor(props) { constructor(props) {
@ -68,26 +68,22 @@ class VolumeSlider extends Component {
} }
return ( return (
<div className={styles.slider}> <Styled.Slider>
<span <Styled.Volume onClick={() => this.setMuted(!muted)}>
className={styles.volume}
onClick={() => this.setMuted(!muted)}
>
<i <i
tabIndex="-1" tabIndex="-1"
className={`icon-bbb-${this.getVolumeIcon()}`} className={`icon-bbb-${this.getVolumeIcon()}`}
/> />
</span> </Styled.Volume>
<input <Styled.VolumeSlider
className={styles.volumeSlider}
type="range" type="range"
min={0} min={0}
max={1} max={1}
step={0.02} step={0.02}
value={muted ? 0 : volume} value={muted ? 0 : volume}
onChange={(e)=> this.handleOnChange(e.target.valueAsNumber)} onChange={(e) => this.handleOnChange(e.target.valueAsNumber)}
/> />
</div> </Styled.Slider>
); );
} }
} }

View File

@ -1,21 +1,7 @@
@import "../../../stylesheets/variables/_all"; import styled from 'styled-components';
%baseIndicator { const Slider = styled.div`
width: 0.9em; width: 0.9em;
}
%baseIndicatorLabel {
font-size: var(--font-size-base);
margin: 0 0 0 0.5rem;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
vertical-align: middle;
max-width: 20vw;
}
.slider {
@extend %baseIndicator;
display: flex; display: flex;
position: relative; position: relative;
bottom: 3.5em; bottom: 3.5em;
@ -25,23 +11,27 @@
background-color: rgba(0,0,0,0.5); background-color: rgba(0,0,0,0.5);
border-radius: 32px; border-radius: 32px;
i { & > i {
color: white; color: white;
transition: 0.5s; transition: 0.5s;
font-size: 200%; font-size: 200%;
cursor: pointer; cursor: pointer;
} }
z-index: 2; z-index: 2;
} `;
.volumeSlider { const Volume = styled.span`
width: 100%;
cursor: pointer;
}
.volume {
margin-right: 0.5em; margin-right: 0.5em;
cursor: pointer; cursor: pointer;
} `;
const VolumeSlider = styled.input`
width: 100%;
cursor: pointer;
`;
export default {
Slider,
Volume,
VolumeSlider,
};