Skip to content

Commit

Permalink
Tidyup, post video length test'
Browse files Browse the repository at this point in the history
  • Loading branch information
AndyEPhipps committed Oct 3, 2023
1 parent dfffc3d commit ee39686
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 16 deletions.
3 changes: 1 addition & 2 deletions src/components/Molecules/Promo/Promo.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ const Promo = ({
if (videoEl.current.duration) {
// Calculate the percentage of the video played:
const percentage = Math.round((videoEl.current.currentTime / videoEl.current.duration) * 100);
// setVideoProgress(percentage);

// Rounding
const nearest = 1;
const roundedPercentage = (percentage + nearest / 2) - ((percentage + nearest / 2) % nearest);
setVideoProgress(roundedPercentage);
Expand Down
15 changes: 7 additions & 8 deletions src/components/Molecules/Promo/Promo.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,9 @@ Promo w/Video
const defaultData = require('../../../styleguide/data/data').defaultData;import Text from '../../Atoms/Text/Text';
import Link from '../../Atoms/Link/Link';
import poster from '../../../styleguide/assets/VideoBannerPosterImage.png';
const shortVideoSrc =
'https://videos.ctfassets.net/zsfivwzfgl3t/6E6MTXiKrqCNviLx6uW9L9/54554151bc846a9946c5cae17533ec64/6-second-video.mp4';
const longVideoSrc =
'https://videos.ctfassets.net/zsfivwzfgl3t/5ZHe4jVngF1uAVeSXEQdNI/8ac0c9ab100e610adb8f3bff6a113e14/15-second-video.mp4';
const src =
'https://www.comicrelief.com/sites/default/files/downloads/Creativists_Logo_Web_small_V2_0.mp4';


<div>
<Text tag="h2" size="xl" color="black">
Expand All @@ -174,7 +173,7 @@ const longVideoSrc =
copyLeft={true}
hasOverlay={true}
position="upper"
video={shortVideoSrc}
video={src}
poster={poster}
>
<Text
Expand Down Expand Up @@ -214,7 +213,7 @@ const longVideoSrc =
copyLeft={true}
hasOverlay={true}
position="end"
video={shortVideoSrc}
video={src}
autoPlay={false}
poster={poster}
>
Expand Down Expand Up @@ -255,7 +254,7 @@ const longVideoSrc =
copyLeft={true}
hasOverlay={true}
position="lower"
video={shortVideoSrc}
video={src}
poster={poster}
autoPlay={false}
>
Expand Down Expand Up @@ -294,7 +293,7 @@ const longVideoSrc =
imageAltText=""
copyLeft={false}
hasOverlay={true}
video={shortVideoSrc}
video={src}
loop={false}
poster={poster}
autoPlay={false}
Expand Down
6 changes: 0 additions & 6 deletions src/components/Molecules/Promo/Promo.style.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,6 @@ const PlayButtonWrapper = styled.div`
// opacity: 1; // debug
}
}
// Reposition button accordingly:
// ${({ percentLeft }) => percentLeft && css`
// top: ${percentLeft}px; // lol
// `}
`;

export {
Expand Down

0 comments on commit ee39686

Please sign in to comment.