From 421975488e55ada04f04cd4b6aa9d079fa581bbd Mon Sep 17 00:00:00 2001 From: Sendou Date: Mon, 24 Feb 2020 18:32:33 +0200 Subject: [PATCH] team page progress --- .../src/components/team/Results.tsx | 133 +++++++++++------- 1 file changed, 82 insertions(+), 51 deletions(-) diff --git a/frontend-react/src/components/team/Results.tsx b/frontend-react/src/components/team/Results.tsx index 54bf02616..45221e6f2 100644 --- a/frontend-react/src/components/team/Results.tsx +++ b/frontend-react/src/components/team/Results.tsx @@ -9,6 +9,7 @@ import MyThemeContext from "../../themeContext" import { IconButton } from "@chakra-ui/core" import { FaTwitter } from "react-icons/fa" import TweetEmbed from "react-tweet-embed" +import useBreakPoints from "../../hooks/useBreakPoints" interface ResultsProps { results: TournamentResult[] @@ -36,6 +37,7 @@ const Results: React.FC = ({ results, canAddResults }) => { [key: string]: boolean }>({}) const { grayWithShade } = useContext(MyThemeContext) + const isSmall = useBreakPoints(350) console.log("results", results) return ( @@ -46,68 +48,97 @@ const Results: React.FC = ({ results, canAddResults }) => { Add tournament result )} - + {results.map(result => { return ( - - {result.placement < 4 ? ( - - {`Placement - - ) : ( - - {result.placement} - - {ordinal_suffix_of(result.placement)} - - - )}{" "} + {result.placement < 4 ? ( - {result.tournament_name} + {`Placement - + ) : ( + + {result.placement} + + {ordinal_suffix_of(result.placement)} + + + )}{" "} + + {result.tournament_name} + + {!isSmall && ( + {new Date(parseInt(result.date)).toLocaleDateString()} - {" "} - - {result.tweet_id && ( - - setExpandedTweets({ - ...expandedTweets, - [result.tweet_id as string]: !expandedTweets[ - result.tweet_id as string - ], - }) - } - /> - )} + )}{" "} + + {result.tweet_id && ( + + setExpandedTweets({ + ...expandedTweets, + [result.tweet_id as string]: !expandedTweets[ + result.tweet_id as string + ], + }) + } + /> + )} {result.tweet_id && expandedTweets[result.tweet_id] && ( - + <> + + + {!isSmall && } + + )} )