2022-01-28 13:44:58 +00:00
|
|
|
import React from "react";
|
|
|
|
import styled from "styled-components";
|
|
|
|
import PropTypes from "prop-types";
|
|
|
|
import { Base } from "@appserver/components/themes";
|
2020-04-25 18:03:13 +00:00
|
|
|
|
|
|
|
const StyledProgress = styled.div`
|
|
|
|
display: inline-block;
|
|
|
|
|
2020-10-16 12:38:04 +00:00
|
|
|
.slider-container {
|
|
|
|
display: inline-block;
|
2020-04-25 18:03:13 +00:00
|
|
|
border-radius: 2px;
|
2020-10-16 12:38:04 +00:00
|
|
|
position: relative;
|
|
|
|
width: ${(props) => props.width}px;
|
|
|
|
height: 6px;
|
2022-01-28 13:44:58 +00:00
|
|
|
background: ${(props) =>
|
|
|
|
props.theme.mediaViewer.progressBar.backgroundColor};
|
2020-10-16 12:38:04 +00:00
|
|
|
margin: 15px 0;
|
2020-05-13 07:18:28 +00:00
|
|
|
vertical-align: middle;
|
2020-04-25 18:03:13 +00:00
|
|
|
}
|
2020-10-16 12:38:04 +00:00
|
|
|
.fill {
|
2020-04-25 18:03:13 +00:00
|
|
|
cursor: pointer;
|
2020-10-16 12:38:04 +00:00
|
|
|
width: ${(props) => 100 * props.value}%;
|
|
|
|
position: absolute;
|
|
|
|
|
|
|
|
top: calc(50% - 3px);
|
|
|
|
height: 6px;
|
2021-12-24 16:43:52 +00:00
|
|
|
background: ${(props) => props.theme.mediaViewer.progressBar.background};
|
2020-04-25 18:03:13 +00:00
|
|
|
border-radius: 2px;
|
|
|
|
}
|
2022-01-28 13:44:58 +00:00
|
|
|
input[type="range"] {
|
2020-10-16 12:38:04 +00:00
|
|
|
display: block;
|
|
|
|
overflow: visible;
|
|
|
|
background: transparent;
|
|
|
|
width: ${(props) => props.width}px;
|
|
|
|
height: 6px;
|
|
|
|
outline: none;
|
|
|
|
margin: 0;
|
|
|
|
-webkit-appearance: none;
|
|
|
|
position: relative;
|
|
|
|
cursor: pointer;
|
2020-04-25 18:03:13 +00:00
|
|
|
}
|
|
|
|
|
2022-01-28 13:44:58 +00:00
|
|
|
input[type="range"]::-webkit-slider-thumb {
|
2020-10-16 12:38:04 +00:00
|
|
|
position: relative;
|
|
|
|
appearance: none;
|
|
|
|
box-sizing: content-box;
|
|
|
|
width: 12px;
|
|
|
|
height: 12px;
|
|
|
|
margin-top: -3px;
|
|
|
|
background: white;
|
|
|
|
border-radius: 50%;
|
|
|
|
|
|
|
|
cursor: pointer;
|
2020-04-25 18:03:13 +00:00
|
|
|
}
|
2022-01-28 13:44:58 +00:00
|
|
|
input[type="range"]::-moz-range-thumb {
|
2020-10-16 12:38:04 +00:00
|
|
|
position: relative;
|
|
|
|
appearance: none;
|
|
|
|
box-sizing: content-box;
|
|
|
|
width: 12px;
|
|
|
|
height: 12px;
|
|
|
|
background: white;
|
|
|
|
border-radius: 50%;
|
|
|
|
margin-top: -3px;
|
|
|
|
cursor: pointer;
|
2020-04-25 18:03:13 +00:00
|
|
|
}
|
2022-01-28 13:44:58 +00:00
|
|
|
input[type="range"]::-ms-thumb {
|
2020-10-16 12:38:04 +00:00
|
|
|
position: relative;
|
|
|
|
appearance: none;
|
|
|
|
box-sizing: content-box;
|
|
|
|
width: 12px;
|
|
|
|
height: 12px;
|
|
|
|
background: white;
|
|
|
|
border-radius: 50%;
|
|
|
|
margin-top: -3px;
|
|
|
|
cursor: pointer;
|
2020-04-25 18:03:13 +00:00
|
|
|
}
|
|
|
|
|
2022-01-28 13:44:58 +00:00
|
|
|
input[type="range"]::-webkit-slider-runnable-track {
|
2020-04-25 18:03:13 +00:00
|
|
|
margin: 12px 0;
|
|
|
|
height: 6px;
|
|
|
|
border-radius: 2px;
|
|
|
|
cursor: pointer;
|
|
|
|
-webkit-appearance: none;
|
|
|
|
text-align: right;
|
|
|
|
pointer-events: none;
|
|
|
|
}
|
2022-01-28 13:44:58 +00:00
|
|
|
input[type="range"]::-moz-range-track {
|
2020-04-25 18:03:13 +00:00
|
|
|
margin: 12px 0;
|
|
|
|
height: 6px;
|
|
|
|
border-radius: 2px;
|
|
|
|
cursor: pointer;
|
|
|
|
-webkit-appearance: none;
|
|
|
|
text-align: right;
|
|
|
|
pointer-events: none;
|
|
|
|
}
|
2022-01-28 13:44:58 +00:00
|
|
|
input[type="range"]::-ms-track {
|
2020-04-25 18:03:13 +00:00
|
|
|
border-color: transparent;
|
|
|
|
color: transparent;
|
2020-10-16 12:38:04 +00:00
|
|
|
|
2020-04-25 18:03:13 +00:00
|
|
|
margin: 12px 0;
|
|
|
|
height: 6px;
|
|
|
|
border-radius: 2px;
|
|
|
|
cursor: pointer;
|
|
|
|
-webkit-appearance: none;
|
|
|
|
text-align: right;
|
|
|
|
pointer-events: none;
|
|
|
|
}
|
|
|
|
`;
|
2021-12-24 16:43:52 +00:00
|
|
|
|
|
|
|
StyledProgress.defaultProps = { theme: Base };
|
2020-10-16 12:38:04 +00:00
|
|
|
const Progress = (props) => {
|
2020-04-30 07:35:02 +00:00
|
|
|
return (
|
2020-10-16 12:38:04 +00:00
|
|
|
<StyledProgress {...props}>
|
2020-04-30 07:35:02 +00:00
|
|
|
<div className="slider-container">
|
|
|
|
<div className="fill"></div>
|
|
|
|
<input
|
2020-10-16 12:38:04 +00:00
|
|
|
type="range"
|
|
|
|
min={0}
|
|
|
|
max={0.999999}
|
|
|
|
step="any"
|
2020-04-30 07:35:02 +00:00
|
|
|
value={props.value}
|
|
|
|
onMouseDown={props.handleSeekMouseDown}
|
2020-05-17 17:00:45 +00:00
|
|
|
onChange={(event) => props.handleSeekChange(event)}
|
2020-04-30 07:35:02 +00:00
|
|
|
onMouseUp={props.handleSeekMouseUp}
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
</StyledProgress>
|
|
|
|
);
|
2020-10-16 12:38:04 +00:00
|
|
|
};
|
2020-04-25 18:03:13 +00:00
|
|
|
|
2020-04-30 07:35:02 +00:00
|
|
|
Progress.propTypes = {
|
|
|
|
value: PropTypes.number,
|
|
|
|
handleSeekMouseDown: PropTypes.func,
|
|
|
|
handleSeekChange: PropTypes.func,
|
2020-10-16 12:38:04 +00:00
|
|
|
handleSeekMouseUp: PropTypes.func,
|
|
|
|
};
|
2020-04-25 18:03:13 +00:00
|
|
|
|
2020-10-16 12:38:04 +00:00
|
|
|
export default Progress;
|