cursor pointer on whole button in desktop challenge menu and full time deadline render in mini challenge label

This commit is contained in:
mattyl006 2022-07-18 11:19:23 +02:00
parent 92f32bcb13
commit 98f5848993
3 changed files with 17 additions and 4 deletions

View File

@ -23,6 +23,10 @@ const Option = styled(FlexColumn)`
transition: background-color 0.3s ease-in-out; transition: background-color 0.3s ease-in-out;
cursor: pointer; cursor: pointer;
* {
cursor: pointer;
}
&:hover { &:hover {
background-color: ${({theme}) => theme.colors.green05}; background-color: ${({theme}) => theme.colors.green05};
} }

View File

@ -18,7 +18,16 @@ const HoverLabel = styled(Body)`
color: ${({theme}) => theme.colors.white}; color: ${({theme}) => theme.colors.white};
`; `;
const renderHoverLabel = (type) => { const renderDeadlineTime = (time) => {
if (time) {
const date = time.slice(0, 10);
const hour = time.slice(11, 16);
return `${date} ${hour}`;
}
return '';
}
const renderHoverLabel = (type, time) => {
const hoverLabel = (label) => const hoverLabel = (label) =>
<HoverLabel className='HoverLabel' type={type}> <HoverLabel className='HoverLabel' type={type}>
{label} {label}
@ -32,7 +41,7 @@ const renderHoverLabel = (type) => {
case 'baseline': case 'baseline':
return hoverLabel('baseline'); return hoverLabel('baseline');
case 'deadline': case 'deadline':
return hoverLabel('deadline'); return hoverLabel(`deadline ${renderDeadlineTime(time)}`);
case 'bestScore': case 'bestScore':
return hoverLabel('best score'); return hoverLabel('best score');
case 'text': case 'text':
@ -65,7 +74,7 @@ const IconLabel = (props) => {
<Medium as='p'> <Medium as='p'>
{props.children} {props.children}
</Medium> : ''} </Medium> : ''}
{renderHoverLabel(props.type)} {renderHoverLabel(props.type, props.time)}
</IconLabelStyle> </IconLabelStyle>
); );
} }

View File

@ -71,7 +71,7 @@ const MiniChallenge = (props) => {
<IconLabel size='24px' gap='8px' type='bestScore'> <IconLabel size='24px' gap='8px' type='bestScore'>
{props.bestScore ? props.bestScore : 'xxx'} {props.bestScore ? props.bestScore : 'xxx'}
</IconLabel> </IconLabel>
<IconLabel size='24px' gap='8px' type='deadline'> <IconLabel size='24px' gap='8px' type='deadline' time={props.deadline}>
{props.deadline ? props.deadline.slice(0, 10) : 'xxx'} {props.deadline ? props.deadline.slice(0, 10) : 'xxx'}
</IconLabel> </IconLabel>
<IconLabel size='24px' gap='8px' type='baseline'> <IconLabel size='24px' gap='8px' type='baseline'>