From 4d20a97f7999a8f33800f8cc5c55f492ee400730 Mon Sep 17 00:00:00 2001 From: Mateusz Tylka Date: Tue, 11 Apr 2023 16:07:06 +0200 Subject: [PATCH] Table responsive corrections --- .../AllEntries/AllEntries.js | 2 +- .../specific_challenge/Challenge.js | 2 +- .../specific_challenge/ColumnFilterIcon.js | 9 +++-- .../DesktopChallengeMenu.js | 10 ++++-- .../Leaderboard/Leaderboard.js | 2 +- .../specific_challenge/MyEntries/MyEntries.js | 4 +-- src/components/specific_challenge/Table.js | 19 +++++++--- src/utils/fonts.js | 35 ++++++++++--------- 8 files changed, 53 insertions(+), 30 deletions(-) diff --git a/src/components/specific_challenge/AllEntries/AllEntries.js b/src/components/specific_challenge/AllEntries/AllEntries.js index 3b6a417..1760c10 100644 --- a/src/components/specific_challenge/AllEntries/AllEntries.js +++ b/src/components/specific_challenge/AllEntries/AllEntries.js @@ -199,7 +199,7 @@ const AllEntries = (props) => { const desktopRender = () => { return ( - +

All Entries

diff --git a/src/components/specific_challenge/Challenge.js b/src/components/specific_challenge/Challenge.js index 344d466..f739a5d 100644 --- a/src/components/specific_challenge/Challenge.js +++ b/src/components/specific_challenge/Challenge.js @@ -115,7 +115,7 @@ const Challenge = (props) => { diff --git a/src/components/specific_challenge/ColumnFilterIcon.js b/src/components/specific_challenge/ColumnFilterIcon.js index 4acf76f..ea4b387 100644 --- a/src/components/specific_challenge/ColumnFilterIcon.js +++ b/src/components/specific_challenge/ColumnFilterIcon.js @@ -9,7 +9,8 @@ const ColumnFilterIcon = (props) => { if (props.index === props.active) { return ( { } else { return ( { return ( <> { .toLowerCase() .replace(' ', '')}`} > -

{option}

+

+ {option} +

); })} diff --git a/src/components/specific_challenge/Leaderboard/Leaderboard.js b/src/components/specific_challenge/Leaderboard/Leaderboard.js index 35289e4..837f613 100644 --- a/src/components/specific_challenge/Leaderboard/Leaderboard.js +++ b/src/components/specific_challenge/Leaderboard/Leaderboard.js @@ -225,7 +225,7 @@ const Leaderboard = (props) => { const desktopRender = () => { return ( - +

Leaderboard

diff --git a/src/components/specific_challenge/MyEntries/MyEntries.js b/src/components/specific_challenge/MyEntries/MyEntries.js index 3f77d47..8314ed5 100644 --- a/src/components/specific_challenge/MyEntries/MyEntries.js +++ b/src/components/specific_challenge/MyEntries/MyEntries.js @@ -175,7 +175,7 @@ const MyEntries = (props) => { const desktopRender = () => { return ( - +

My Entries @@ -189,7 +189,7 @@ const MyEntries = (props) => { headerElements={getMyEntriesHeader()} possibleMetrics={getPossibleMetrics()} gridTemplateColumns={ - '1fr ' + '4fr '.repeat(getMyEntriesHeader().length - 1) + '1fr ' + '3fr '.repeat(getMyEntriesHeader().length - 2) + ' 4fr' } staticColumnElements={[ { name: 'id', format: null, order: 1, align: 'left' }, diff --git a/src/components/specific_challenge/Table.js b/src/components/specific_challenge/Table.js index d032605..7f34fc0 100644 --- a/src/components/specific_challenge/Table.js +++ b/src/components/specific_challenge/Table.js @@ -106,6 +106,8 @@ const Table = (props) => { order={props.iterableColumnElement.order} textAlign={props.iterableColumnElement.align} minWidth="72px" + margin="auto 0" + overflowWrap="anywhere" > {IS_MOBILE() && ( @@ -130,6 +132,8 @@ const Table = (props) => { as="td" order={elemName.order} textAlign={elemName.align} + margin="auto 0" + overflowWrap="anywhere" > {IS_MOBILE() && ( @@ -156,7 +160,8 @@ const Table = (props) => { gridGap="20px" position="relative" width="100%" - padding="4px" + padding="0 6px" + minHeight="44px" margin="0 0 6px 0" gridTemplateColumns={props.gridTemplateColumns} > @@ -183,8 +188,8 @@ const Table = (props) => { cursor={elem !== '#' ? 'pointer' : ''} textAlign={elem === 'when' ? 'right' : 'left'} width={elem === 'when' ? '100%' : 'auto'} - padding="0 6px 0 0" - overflowWrap="break-word" + padding="0 4px 0 0" + overflowWrap="anywhere" minWidth={elem === 'result' ? '72px' : 'none'} > {elem.replace('.', ' ')} @@ -200,7 +205,12 @@ const Table = (props) => { ); })} - + {elementsToMap.map((elem, index) => { return ( @@ -215,6 +225,7 @@ const Table = (props) => { position="relative" width="100%" padding="4px" + minHeight="48px" > {rowRender(elem)} {props.headerElements ? metricsRender(elem) : ''} diff --git a/src/utils/fonts.js b/src/utils/fonts.js index 5284a0c..9b2ed9a 100644 --- a/src/utils/fonts.js +++ b/src/utils/fonts.js @@ -1,5 +1,5 @@ import styled from 'styled-components'; -import {Container} from './containers'; +import { Container } from './containers'; const H1 = styled(Container)` display: inline-block; @@ -8,7 +8,7 @@ const H1 = styled(Container)` font-size: 24px; line-height: 24px; letter-spacing: 0.1px; - @media (min-width: ${({theme}) => theme.overMobile}) { + @media (min-width: ${({ theme }) => theme.overMobile}) { font-size: 48px; line-height: 52px; } @@ -16,7 +16,7 @@ const H1 = styled(Container)` const H2 = styled(H1)` font-size: 20px; - @media (min-width: ${({theme}) => theme.overMobile}) { + @media (min-width: ${({ theme }) => theme.overMobile}) { font-size: 32px; line-height: 36px; } @@ -25,9 +25,12 @@ const H2 = styled(H1)` const H3 = styled(H1)` font-size: 18px; line-height: 22px; - @media (min-width: ${({theme}) => theme.overMobile}) { + font-size: ${({ fontSize }) => (fontSize ? fontSize : '18px')}; + + @media (min-width: ${({ theme }) => theme.overMobile}) { font-size: 24px; line-height: 26px; + font-size: ${({ fontSize }) => (fontSize ? fontSize : '24px')}; } `; @@ -37,7 +40,7 @@ const Body = styled(Container)` font-weight: 300; font-size: 14px; line-height: 20px; - @media (min-width: ${({theme}) => theme.overMobile}) { + @media (min-width: ${({ theme }) => theme.overMobile}) { font-weight: 400; font-size: 16px; line-height: 22px; @@ -46,9 +49,9 @@ const Body = styled(Container)` const Medium = styled(Body)` font-weight: 400; - @media (min-width: ${({theme}) => theme.overMobile}) { + @media (min-width: ${({ theme }) => theme.overMobile}) { font-weight: 500; - font-size: ${({fontSize}) => fontSize ? fontSize : '16px'} + font-size: ${({ fontSize }) => (fontSize ? fontSize : '16px')}; } `; @@ -63,7 +66,7 @@ const Menu = styled(Container)` const Label = styled(Menu)` display: inline-block; font-weight: 300; - @media (min-width: ${({theme}) => theme.overMobile}) { + @media (min-width: ${({ theme }) => theme.overMobile}) { font-size: 22px; line-height: 24px; } @@ -75,22 +78,22 @@ const Code = styled(Container)` font-size: 12px; line-height: 18px; font-weight: 300; - color: ${({theme}) => theme.colors.white}; + color: ${({ theme }) => theme.colors.white}; max-width: 600px; overflow-wrap: break-word; &:before { - display: ${({before}) => before ? 'inline-block' : 'none'}; + display: ${({ before }) => (before ? 'inline-block' : 'none')}; content: '~$'; - color: ${({theme}) => theme.colors.green}; + color: ${({ theme }) => theme.colors.green}; font-weight: 400; margin: 0 4px 0 0; - @media (min-width: ${({theme}) => theme.overMobile}) { + @media (min-width: ${({ theme }) => theme.overMobile}) { font-weight: 500; } } - @media (min-width: ${({theme}) => theme.overMobile}) { + @media (min-width: ${({ theme }) => theme.overMobile}) { font-size: 16px; line-height: 24px; font-weight: 400; @@ -98,11 +101,11 @@ const Code = styled(Container)` `; const CodeMedium = styled(Code)` - color: ${({theme}) => theme.colors.green}; + color: ${({ theme }) => theme.colors.green}; font-weight: 400; - @media (min-width: ${({theme}) => theme.overMobile}) { + @media (min-width: ${({ theme }) => theme.overMobile}) { font-weight: 500; } `; -export {H1, H2, H3, Body, Medium, Menu, Label, Code, CodeMedium}; \ No newline at end of file +export { H1, H2, H3, Body, Medium, Menu, Label, Code, CodeMedium };