style changes

This commit is contained in:
cv
2021-04-06 13:09:58 +02:00
parent 0868920400
commit e20d9d91ae
6 changed files with 85 additions and 67 deletions
+1
View File
@@ -14,6 +14,7 @@
"framer-motion": "^4", "framer-motion": "^4",
"react": "^17.0.1", "react": "^17.0.1",
"react-dom": "^17.0.1", "react-dom": "^17.0.1",
"react-icons": "^4.2.0",
"react-router": "^5.2.0", "react-router": "^5.2.0",
"react-router-dom": "^5.2.0", "react-router-dom": "^5.2.0",
"react-scripts": "4.0.3", "react-scripts": "4.0.3",
@@ -5,14 +5,13 @@ function display(seconds) {
const hours = seconds / 3600; const hours = seconds / 3600;
const minutes = (seconds % 3600) / 60; const minutes = (seconds % 3600) / 60;
if (hours < 1) return [minutes, seconds % 60].map(format).join(':'); return [hours, minutes, seconds % 60].map(format).join(':');
else return [hours, minutes, seconds % 60].map(format).join(':');
} }
export default function Countdown({ time, small }) { export default function Countdown({ time, small }) {
return ( return (
<div className={small ? styles.countdownClockSmall : styles.countdownClock}> <div className={small ? styles.countdownClockSmall : styles.countdownClock}>
{time === null ? '- -:- -' : display(time * 60)} {time === null ? '-- : -- : --' : display(time)}
</div> </div>
); );
} }
@@ -1,21 +1,26 @@
@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;600;800&display=swap'); @import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;600;800&display=swap');
.countdownClock { /* Common */
.countdownClock,
.countdownClockSmall {
font-family: 'Open Sans', sans-serif; font-family: 'Open Sans', sans-serif;
line-height: 0.9;
}
/* Viewers */
.countdownClock {
font-size: 18vw; font-size: 18vw;
margin-top: 6vh; margin-top: 6vh;
margin-bottom: 5vh; margin-bottom: 5vh;
text-align: center; text-align: center;
letter-spacing: 0.125em; letter-spacing: 0.125em;
line-height: 0.9;
} }
/* Editor */
.countdownClockSmall { .countdownClockSmall {
font-family: 'Open Sans', sans-serif; font-size: 4em;
font-size: 6em;
text-align: center; text-align: center;
letter-spacing: 0.1em; letter-spacing: 0.1em;
line-height: 0.9;
font-weight: 600; font-weight: 600;
color: #333; color: #333;
} }
+40 -43
View File
@@ -1,7 +1,13 @@
import { Button } from '@chakra-ui/button'; import { IconButton } from '@chakra-ui/button';
import style from './PlaybackControl.module.css'; import style from './PlaybackControl.module.css';
import Countdown from '../../common/components/countdown/Countdown'; import Countdown from '../../common/components/countdown/Countdown';
import { ArrowBackIcon, ArrowForwardIcon } from '@chakra-ui/icons'; import {
FiPlay,
FiPause,
FiSkipBack,
FiSkipForward,
FiClock,
} from 'react-icons/fi';
// BUTTON DEFINITION // BUTTON DEFINITION
const defProps = { const defProps = {
@@ -9,8 +15,9 @@ const defProps = {
variant: 'outline', variant: 'outline',
}; };
const bigSize = 120; const size = {
width: 90,
};
export default function PlaybackControl(props) { export default function PlaybackControl(props) {
const { time, roll } = props; const { time, roll } = props;
@@ -20,57 +27,47 @@ export default function PlaybackControl(props) {
<div className={style.timer}> <div className={style.timer}>
<Countdown time={time} small /> <Countdown time={time} small />
</div> </div>
<div className={style.start}>
<span className={style.tag}>Started at </span>
<span className={style.time}>12:01</span>
</div>
<div className={style.finish}>
<span className={style.tag}>Finish at </span>
<span className={style.time}>13:01</span>
</div>
</div> </div>
<div className={style.playbackContainer}> <div className={style.playbackContainer}>
<Button <IconButton
width={bigSize} {...size}
icon={<FiPlay />}
colorScheme='green' colorScheme='green'
className={style.start}
disabled={roll}
onClick={() => props.playbackControl('play')} onClick={() => props.playbackControl('play')}
> />
Start <IconButton
</Button> {...size}
<Button icon={<FiPause />}
width={bigSize}
colorScheme='orange' colorScheme='orange'
className={style.pause}
disabled={roll}
onClick={() => props.playbackControl('pause')} onClick={() => props.playbackControl('pause')}
> />
Pause <IconButton
</Button> {...size}
</div>
<div className={style.trackContainer}>
<Button
width={bigSize}
{...defProps} {...defProps}
leftIcon={<ArrowBackIcon />} icon={<FiSkipBack />}
className={style.prev}
disabled={roll}
onClick={() => props.playbackControl('previous')} onClick={() => props.playbackControl('previous')}
> />
Prev <IconButton
</Button> {...size}
<Button
width={bigSize}
{...defProps} {...defProps}
rightIcon={<ArrowForwardIcon />} icon={<FiSkipForward />}
className={style.next}
disabled={roll}
onClick={() => props.playbackControl('next')} onClick={() => props.playbackControl('next')}
> />
Next <IconButton
</Button> {...size}
<Button icon={<FiClock />}
width={bigSize}
colorScheme='blue' colorScheme='blue'
className={style.reset}
onClick={() => props.playbackControl('roll')} onClick={() => props.playbackControl('roll')}
disabled />
>
Roll
</Button>
</div> </div>
</div> </div>
); );
@@ -1,43 +1,54 @@
.mainContainer { .mainContainer {
width: 90%; width: 100%;
display: flex; display: flex;
margin: 0 auto; margin: 0 auto;
flex-direction: column; flex-direction: column;
gap: 5px; gap: 5px;
} }
.timeContainer,
.playbackContainer {
border: 1px solid rgb(226, 232, 240);
border-radius: 8px;
padding: 0.5em;
}
.timeContainer { .timeContainer {
display: grid; display: grid;
gap: 5px;
grid-template-areas: grid-template-areas:
'timer plus1 plus5' 'clk clk ...'
'timer minu1 minu5'; 'sta fin ...';
grid-template-columns: auto 50px 50px; grid-template-rows: 1fr auto;
grid-template-columns: 1fr 1fr 80px;
gap: 5px;
justify-items: start;
} }
.timer { .timer {
grid-area: timer; grid-area: clk;
} }
.plus1 { .start {
grid-area: plus1; grid-area: sta;
} }
.plus5 { .finish {
grid-area: plus5; grid-area: fin;
} }
.minu1 { .time {
grid-area: minu1; color: #333;
font-size: 1.1em;
} }
.minu5 { .tag {
grid-area: minu5; color: #666;
font-size: 0.9em;
} }
.playbackContainer, .playbackContainer {
.trackContainer {
display: flex; display: flex;
justify-content: space-evenly; justify-content: space-evenly;
padding-top: 0.5em; padding-top: 0.5em;
gap: 10px;
} }
+5
View File
@@ -9944,6 +9944,11 @@ react-focus-lock@2.5.0:
use-callback-ref "^1.2.1" use-callback-ref "^1.2.1"
use-sidecar "^1.0.1" use-sidecar "^1.0.1"
react-icons@^4.2.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/react-icons/-/react-icons-4.2.0.tgz#6dda80c8a8f338ff96a1851424d63083282630d0"
integrity sha512-rmzEDFt+AVXRzD7zDE21gcxyBizD/3NqjbX6cmViAgdqfJ2UiLer8927/QhhrXQV7dEj/1EGuOTPp7JnLYVJKQ==
react-is@^16.6.0, react-is@^16.7.0, react-is@^16.8.1: react-is@^16.6.0, react-is@^16.7.0, react-is@^16.8.1:
version "16.13.1" version "16.13.1"
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4" resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"