2023-05-16 03:46:44 +08:00
|
|
|
import styled from 'styled-components';
|
|
|
|
import { phoneLandscape, smallOnly } from '/imports/ui/stylesheets/styled-components/breakpoints';
|
|
|
|
import { borderRadius } from '/imports/ui/stylesheets/styled-components/general';
|
|
|
|
import {
|
|
|
|
colorSuccess,
|
|
|
|
colorDanger,
|
|
|
|
} from '/imports/ui/stylesheets/styled-components/palette';
|
2022-09-10 04:15:11 +08:00
|
|
|
import { fontSizeBase, fontSizeXS } from '/imports/ui/stylesheets/styled-components/typography';
|
2023-05-16 03:46:44 +08:00
|
|
|
|
|
|
|
const colorTimerRunning = `${colorSuccess}`;
|
|
|
|
const colorTimerStopped = `${colorDanger}`;
|
|
|
|
const timerMarginSM = `.5rem`;
|
|
|
|
const timerPaddingXSM = `.13rem`;
|
|
|
|
const timerPaddingSM = `.25rem`;
|
|
|
|
const timerPaddingLg = `.75rem`;
|
|
|
|
const timerPaddingXL = `1.62rem`;
|
|
|
|
const timerMaxWidth = `10rem`;
|
|
|
|
const timerFontWeight = `400`;
|
|
|
|
const timerBorderRadius = `2rem`;
|
|
|
|
|
|
|
|
const TimerWrapper = styled.div`
|
|
|
|
overflow: hidden;
|
|
|
|
margin-left: auto;
|
|
|
|
`;
|
|
|
|
|
|
|
|
const Timer = styled.div`
|
|
|
|
display: flex;
|
|
|
|
max-height: ${timerPaddingXL});
|
|
|
|
`;
|
|
|
|
|
|
|
|
const timerRunning = `
|
|
|
|
background-color: ${colorTimerRunning};
|
|
|
|
border: solid 2px ${colorTimerRunning};
|
|
|
|
`;
|
|
|
|
|
|
|
|
const timerStopped = `
|
|
|
|
background-color: ${colorTimerStopped};
|
|
|
|
border: solid 2px ${colorTimerStopped};
|
|
|
|
`;
|
|
|
|
|
|
|
|
const disabledStyle = `
|
|
|
|
cursor: default;
|
|
|
|
`;
|
|
|
|
|
|
|
|
const hiddenStyle = `
|
|
|
|
@media ${smallOnly} {
|
|
|
|
visibility: hidden;
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2022-09-10 04:15:11 +08:00
|
|
|
const TimerButton = styled.div`
|
2023-05-16 03:46:44 +08:00
|
|
|
@include highContrastOutline();
|
|
|
|
cursor: pointer;
|
|
|
|
color: white;
|
|
|
|
font-weight: ${timerFontWeight};
|
|
|
|
border-radius: ${timerBorderRadius} ${timerBorderRadius};
|
|
|
|
font-size: ${fontSizeBase};
|
|
|
|
margin-left: ${borderRadius};
|
|
|
|
margin-right: ${borderRadius};
|
|
|
|
|
|
|
|
@media ${phoneLandscape} {
|
|
|
|
height: 1rem;
|
|
|
|
}
|
|
|
|
|
|
|
|
span {
|
|
|
|
overflow: hidden;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
white-space: nowrap;
|
|
|
|
max-width: ${timerMaxWidth};
|
|
|
|
|
|
|
|
@media ${phoneLandscape} {
|
|
|
|
font-size: ${fontSizeXS};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
i {
|
2022-09-10 04:15:11 +08:00
|
|
|
font-size: var(--font-size-small);
|
2023-05-16 03:46:44 +08:00
|
|
|
width: 1rem;
|
|
|
|
height: 1rem;
|
|
|
|
border-radius: 50%;
|
|
|
|
|
|
|
|
@media ${phoneLandscape} {
|
|
|
|
height: ${timerMarginSM};
|
|
|
|
width: ${timerMarginSM};
|
|
|
|
font-size: ${fontSizeXS};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
${({ running }) => (running ? timerRunning : timerStopped)};
|
|
|
|
${({ disabled }) => disabled && disabledStyle};
|
|
|
|
${({ hide }) => hide && hiddenStyle};
|
|
|
|
`;
|
|
|
|
|
|
|
|
const time = `
|
|
|
|
box-sizing: border-box;
|
|
|
|
display: flex;
|
|
|
|
align-self: center;
|
|
|
|
padding: 0 ${timerPaddingSM} 0 0;
|
|
|
|
`;
|
|
|
|
|
|
|
|
const TimerContent = styled.div`
|
|
|
|
${time}
|
|
|
|
display: flex;
|
|
|
|
|
|
|
|
[dir="ltr"] & {
|
|
|
|
span:first-child {
|
|
|
|
padding: 0 ${timerPaddingSM};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
[dir="rtl"] & {
|
|
|
|
span:last-child {
|
|
|
|
padding: 0 ${timerPaddingSM};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
const TimerIcon = styled.span`
|
|
|
|
${time}
|
|
|
|
`;
|
|
|
|
|
|
|
|
const TimerTime = styled.span`
|
|
|
|
${time}
|
|
|
|
`;
|
|
|
|
|
|
|
|
export default {
|
|
|
|
TimerWrapper,
|
|
|
|
Timer,
|
2022-09-10 04:15:11 +08:00
|
|
|
TimerButton,
|
2023-05-16 03:46:44 +08:00
|
|
|
TimerContent,
|
|
|
|
TimerIcon,
|
|
|
|
TimerTime,
|
2022-09-10 04:15:11 +08:00
|
|
|
};
|