diff --git a/packages/components/media-player/src/PlayerControls/index.js b/packages/components/media-player/src/PlayerControls/index.js
index fd12c5bc..8cdf8acc 100644
--- a/packages/components/media-player/src/PlayerControls/index.js
+++ b/packages/components/media-player/src/PlayerControls/index.js
@@ -1,7 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
-
-import style from './index.module.css';
+import isEqual from 'react-fast-compare';
import {
faSave,
@@ -19,18 +18,14 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import PlaybackRate from '../PlaybackRate';
import TimeBox from './TimeBox.js';
+import style from './index.module.scss';
+
class PlayerControls extends React.Component {
shouldComponentUpdate = (nextProps) => {
- if (nextProps !== this.props) return true;
-
- return false;
+ return !isEqual(this.props, nextProps);
}
- // to handle backward and forward mouse pressed on btn
- // set a 300 ms interval to repeat the
- // backward or forward function
- // on mouseUp the interval is cleared
setIntervalHelperBackward = () => {
// this.props.skipBackward();
this.interval = setInterval(() => {
@@ -115,7 +110,7 @@ class PlayerControls extends React.Component {
diff --git a/packages/components/media-player/src/PlayerControls/index.module.css b/packages/components/media-player/src/PlayerControls/index.module.scss
similarity index 55%
rename from packages/components/media-player/src/PlayerControls/index.module.css
rename to packages/components/media-player/src/PlayerControls/index.module.scss
index 76d1be6e..01f619b0 100644
--- a/packages/components/media-player/src/PlayerControls/index.module.css
+++ b/packages/components/media-player/src/PlayerControls/index.module.scss
@@ -1,4 +1,4 @@
-@value color-light-shilo, color-darkest-grey, color-light-grey, color-labs-red from '../../../../config/style-guide/colours.module.css';
+@import '../../../../config/style-guide/colours.scss';
.playerControls {
margin-bottom: 0.5em;
@@ -18,11 +18,15 @@
padding: 0.5em;
border: 0;
color: white;
- background: color-darkest-grey;
+ background: $color-darkest-grey;
font-size: 1em;
cursor: pointer;
margin-right: 0.3rem;
margin-top: 0.3rem;
+
+ &:hover {
+ background: $color-dark-grey;
+ }
}
.playBackRate {
@@ -33,24 +37,29 @@
cursor: pointer;
position: relative;
margin-right: 0.3rem;
-}
-.playBackRate::before {
- content: '×';
- position: absolute;
- bottom: -2px;
- left: 21px;
-}
+ &::before {
+ content: '×';
+ position: absolute;
+ bottom: -2px;
+ left: 21px;
+ }
-.playBackRate > select {
- padding-top: 0.5em;
- padding-bottom: 0.5em;
- height: 100%;
- outline: none;
- width: auto;
- width: 100%;
- color: white;
- background-color: color-darkest-grey;
+ & > select {
+ padding-top: 0.5em;
+ padding-bottom: 0.5em;
+ height: 100%;
+ outline: none;
+ width: auto;
+ width: 100%;
+ color: white;
+ background-color: $color-darkest-grey;
+ cursor: pointer;
+
+ &:hover {
+ background-color: $color-dark-grey;
+ }
+ }
}
.timeBox {
@@ -58,32 +67,32 @@
text-align: center;
line-height: 48px;
padding: 0 1em;
- background-color: color-darkest-grey;
-}
+ background-color: $color-darkest-grey;
-.currentTime {
- color: color-light-shilo;
- cursor: pointer;
- font-family: 'Lucida Console', monospace;
-}
+ .currentTime {
+ color: $color-light-shilo;
+ cursor: pointer;
+ font-family: 'Lucida Console', monospace;
+ }
-.separator {
- color: color-light-grey;
- margin: 0 1em;
-}
+ .separator {
+ color: $color-light-grey;
+ margin: 0 1em;
+ }
-.duration {
- color: white;
- font-family: 'Lucida Console', monospace;
+ .duration {
+ color: white;
+ font-family: 'Lucida Console', monospace;
+ }
}
@media (max-width: 768px) {
.playerControls {
- margin: 0 0 10px 0;
display: grid;
- grid-template-rows: 10% 48px 48px;
+ grid-template-rows: 10% 3rem 3rem;
grid-row-gap: 5px;
+ margin: 0 0 0.5rem 0;
}
.playerControls > *:not(:last-child) {
@@ -104,57 +113,34 @@
.playBackRate {
width: 100%;
- border: 0;
- color: white;
- font-size: 1em;
- cursor: pointer;
- position: relative;
grid-column: 1 / span 2;
- }
- .playBackRate::before {
- content: '×';
- position: absolute;
- bottom: 30%;
- left: 21px;
- }
-
- .playBackRate > select {
- padding-top: 0.5em;
- padding-bottom: 0.5em;
- height: 100%;
- outline: none;
- width: auto;
- width: 100%;
- color: white;
- background-color: color-darkest-grey;
+ &::before {
+ bottom: 30%;
+ }
}
.timeBox {
background-color: transparent;
align-self: start;
padding: 0;
- }
-
- .currentTime {
- color: color-light-shilo;
- cursor: pointer;
- float: left;
- font-size: 0.7em;
- line-height: 1em;
- }
- .separator {
- color: color-light-grey;
- margin: 0 1em;
- display: none;
- }
-
- .duration {
- color: white;
- font-size: 0.7em;
- float: right;
- line-height: 1em;
+ .currentTime {
+ float: left;
+ font-size: 0.7em;
+ line-height: 1em;
+ }
+
+ .separator {
+ display: none;
+ }
+
+ .duration {
+ color: white;
+ font-size: 0.7em;
+ float: right;
+ line-height: 1em;
+ }
}
.pip {
diff --git a/packages/components/media-player/src/ProgressBar.js b/packages/components/media-player/src/ProgressBar.js
index 43c90352..3ecf4fd8 100644
--- a/packages/components/media-player/src/ProgressBar.js
+++ b/packages/components/media-player/src/ProgressBar.js
@@ -1,41 +1,43 @@
import React from 'react';
import PropTypes from 'prop-types';
+import isEqual from 'react-fast-compare';
-import style from './ProgressBar.module.css';
+import style from './ProgressBar.module.scss';
class ProgressBar extends React.Component {
-
- // performance optimization
shouldComponentUpdate = (nextProps) => {
- if (nextProps !== this.props) {
- return true;
- }
-
- return false;
+ return !isEqual(this.props, nextProps);
}
- // performance optimization
+
handleOnChange = (e) => {
this.props.buttonClick(e);
}
render() {
return (
-
+
+
+
);
}
}
ProgressBar.propTypes = {
- value: PropTypes.number,
+ value: PropTypes.string,
max: PropTypes.string,
buttonClick: PropTypes.func
};
+ProgressBar.defaultProps = {
+ value: '0',
+ max: '0',
+};
+
export default ProgressBar;
diff --git a/packages/components/media-player/src/ProgressBar.module.css b/packages/components/media-player/src/ProgressBar.module.css
deleted file mode 100644
index f2da5d30..00000000
--- a/packages/components/media-player/src/ProgressBar.module.css
+++ /dev/null
@@ -1,39 +0,0 @@
-@value color-light-grey, color-labs-red from '../../../config/style-guide/colours.module.css';
-
-.bar {
- width: 100%;
- -webkit-appearance: none;
- height: 10px;
- background: #747474;
- margin: 0px;
- outline: none;
- cursor: pointer;
- position: absolute;
- bottom: 0;
- left: 0;
-}
-
-.bar::-webkit-slider-thumb {
- -webkit-appearance: none;
- height: 30px;
- width: 16px;
- background: color-labs-red;
- cursor: pointer;
-}
-
-.bar::-moz-range-thumb {
- height: 30px;
- width: 16px;
- background: color-labs-red;
- cursor: pointer;
- border: 0;
-}
-
-.bar::-webkit-slider-runnable-track {
- width: 100%;
- cursor: pointer;
-}
-
-input[type=range]::-moz-focus-outer {
- border: 0;
-}
diff --git a/packages/components/media-player/src/ProgressBar.module.scss b/packages/components/media-player/src/ProgressBar.module.scss
new file mode 100644
index 00000000..00b4d9eb
--- /dev/null
+++ b/packages/components/media-player/src/ProgressBar.module.scss
@@ -0,0 +1,82 @@
+@import '../../../config/style-guide/colours.scss';
+
+$slider-width-number: 1440;
+$slider-width: #{$slider-width-number}px;
+$slider-height: 10px;
+$background-slider: $color-light-grey;
+$bar-slider-filled: $color-labs-red;
+$thumb-width: 16px;
+$thumb-height: 24px;
+$shadow-size: -7px;
+$fit-thumb-in-slider: -7px;
+
+@function strip-units($number) {
+ @return $number / ($number * 0 + 1);
+}
+
+@function makelongshadow($color, $size) {
+ $val: 1px 0 0 $size $color;
+
+ @for $i from 1 through $slider-width-number {
+ $val: #{$val}, #{$i}px 0 0 $size #{$color};
+ }
+
+ @return $val;
+}
+
+.wrapper {
+ width: 100%;
+ overflow-x: hidden;
+ position: absolute;
+ left: 0;
+ bottom: -16px;
+}
+
+.bar {
+ -webkit-appearance: none;
+ -moz-appearance: none;
+ appearance: none;
+ background: none;
+ cursor: pointer;
+ width: 100%;
+ height: 30px;
+ margin: 0;
+
+ // Chrome
+ &::-webkit-slider-runnable-track {
+ height: $slider-height;
+ width: $slider-width;
+ content: '';
+ pointer-events: none;
+ background: $bar-slider-filled;
+ }
+
+ &::-webkit-slider-thumb {
+ -webkit-appearance: none;
+ height: $thumb-height;
+ width: $thumb-width;
+ margin-top: $fit-thumb-in-slider;
+ background: $color-labs-red;
+ box-shadow: makelongshadow($color-light-grey, $shadow-size);
+ }
+
+ // Firefox
+ &::-moz-range-track {
+ height: $slider-height;
+ width: $slider-width;
+ content: '';
+ pointer-events: none;
+ background: $bar-slider-filled;
+ }
+
+ &::-moz-range-thumb {
+ -moz-appearance: none;
+ height: $thumb-height;
+ width: $thumb-width;
+ margin-top: $fit-thumb-in-slider;
+ border: 0;
+ border-radius: 0;
+ background: $color-labs-red;
+ box-shadow: makelongshadow($color-light-grey, $shadow-size);
+ }
+}
diff --git a/packages/components/media-player/src/RollBack.js b/packages/components/media-player/src/RollBack.js
deleted file mode 100644
index 38707e0e..00000000
--- a/packages/components/media-player/src/RollBack.js
+++ /dev/null
@@ -1,35 +0,0 @@
-import React from 'react';
-import PropTypes from 'prop-types';
-import styles from './RollBack.module.css';
-class RollBack extends React.Component {
-
- render() {
- return (
-
-
Rollback
- Seconds
-
-
-
-
-
-
-
- );
- }
-}
-
-RollBack.propTypes = {
- rollBackValueInSeconds: PropTypes.number,
- handleChangeReplayRollbackValue: PropTypes.func,
- rollBack: PropTypes.func
-};
-
-export default RollBack;
diff --git a/packages/components/media-player/src/RollBack.module.css b/packages/components/media-player/src/RollBack.module.css
deleted file mode 100644
index 3484ffaa..00000000
--- a/packages/components/media-player/src/RollBack.module.css
+++ /dev/null
@@ -1,8 +0,0 @@
-.helpText {
- margin-top: 0;
- margin-bottom: 0.1em;
-}
-
-.rollBackValue {
- font-weight: bold;
-}
diff --git a/packages/components/media-player/src/ScrollIntoView.js b/packages/components/media-player/src/ScrollIntoView.js
deleted file mode 100644
index 8642fa13..00000000
--- a/packages/components/media-player/src/ScrollIntoView.js
+++ /dev/null
@@ -1,25 +0,0 @@
-import React from 'react';
-import PropTypes from 'prop-types';
-
-class ScrollIntoView extends React.Component {
- render() {
- return (
-
- );
- }
-}
-
-ScrollIntoView.propTypes = {
- handleToggle: PropTypes.func,
- isScrollIntoViewOn: PropTypes.bool
-};
-
-export default ScrollIntoView;
diff --git a/packages/components/media-player/src/Select.js b/packages/components/media-player/src/Select.js
index 65bcebef..bdccaa0a 100644
--- a/packages/components/media-player/src/Select.js
+++ b/packages/components/media-player/src/Select.js
@@ -1,7 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
-import style from './Select.module.css';
+import style from './Select.module.scss';
class Select extends React.Component {
@@ -12,7 +12,12 @@ class Select extends React.Component {
});
return (
-