dont show deadline if unable

This commit is contained in:
mattyl006 2022-11-18 10:34:15 +01:00
parent f0a2220577
commit 1c392fea0d

View File

@ -52,6 +52,16 @@ const IconsGrid = styled(Grid)`
`; `;
const MiniChallenge = (props) => { const MiniChallenge = (props) => {
const deadlineRender = () => {
if (props.deadline) {
return (
<IconLabel size='24px' gap='8px' type='deadline' time={props.deadline}>
{props.deadline.slice(0, 10)}
</IconLabel>
);
}
};
return ( return (
<ChallengeStyle as={Link} to={`${CHALLENGE_PAGE}/${props.name}`}> <ChallengeStyle as={Link} to={`${CHALLENGE_PAGE}/${props.name}`}>
<FlexColumn as='article'> <FlexColumn as='article'>
@ -72,9 +82,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' time={props.deadline}> {deadlineRender()}
{props.deadline ? props.deadline.slice(0, 10) : 'xxx'}
</IconLabel>
<IconLabel size='24px' gap='8px' type='baseline'> <IconLabel size='24px' gap='8px' type='baseline'>
{props.baseline ? props.baseline : 'xxx'} {props.baseline ? props.baseline : 'xxx'}
</IconLabel> </IconLabel>