From f423614ae5248f725dab3136f5618a5182f23f24 Mon Sep 17 00:00:00 2001 From: Felix Albrigtsen Date: Wed, 30 Mar 2022 00:30:39 +0200 Subject: [PATCH] Clickable description --- src/client/src/FrontPage.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/client/src/FrontPage.js b/src/client/src/FrontPage.js index f538dcd..a45cbe4 100644 --- a/src/client/src/FrontPage.js +++ b/src/client/src/FrontPage.js @@ -33,6 +33,10 @@ function shorten(description, maxLength) { } function TournamentListItem(props) { + const [longDescription, setLongDescription] = React.useState(false); + function toggleDescription() { + setLongDescription(!longDescription); + } return ( @@ -45,16 +49,16 @@ function TournamentListItem(props) { /> {props.tournament.name} - {shorten(props.tournament.description, 200)} - Start: {props.tournament.startTime.toLocaleString()} - End: {props.tournament.endTime.toLocaleString()} + Start: {props.tournament.startTime.toLocaleString()} + End: {props.tournament.endTime.toLocaleString()} Players {props.tournament.teamCount} / {props.tournament.teamLimit} - - + {longDescription ? props.tournament.description : shorten(props.tournament.description, 200)} + + - +