From 43a7a4e131967b525414dc81bc9f6140192537f4 Mon Sep 17 00:00:00 2001 From: Maria Rushkova <66270386+mrushkova@users.noreply.github.com> Date: Tue, 13 Jul 2021 09:16:20 +0200 Subject: [PATCH] Tablet mode (#101) --- packages/DApp/src/components/Button.tsx | 4 --- packages/DApp/src/components/Card.tsx | 1 + packages/DApp/src/components/PageBar.tsx | 2 +- .../src/components/card/CardCommunity.tsx | 30 +++++++++++++++++-- .../src/components/card/CardVote/CardVote.tsx | 6 ++-- .../DApp/src/components/votes/VoteChart.tsx | 22 ++++++++++---- packages/DApp/src/pages/Info.tsx | 4 +++ 7 files changed, 54 insertions(+), 15 deletions(-) diff --git a/packages/DApp/src/components/Button.tsx b/packages/DApp/src/components/Button.tsx index df2a9de..4e857b6 100644 --- a/packages/DApp/src/components/Button.tsx +++ b/packages/DApp/src/components/Button.tsx @@ -78,8 +78,4 @@ export const VoteBtn = styled(ButtonSecondary)` & > span { font-size: 20px; } - - @media (max-width: 768px) { - width: 305px; - } ` diff --git a/packages/DApp/src/components/Card.tsx b/packages/DApp/src/components/Card.tsx index 2f01c52..6e09b98 100644 --- a/packages/DApp/src/components/Card.tsx +++ b/packages/DApp/src/components/Card.tsx @@ -25,6 +25,7 @@ export const CardCommunityWrap = styled.div` margin: 0; border: none; box-shadow: none; + padding-bottom: 0; } ` export const CardVoteWrap = styled.div` diff --git a/packages/DApp/src/components/PageBar.tsx b/packages/DApp/src/components/PageBar.tsx index cc1c22e..6aa568a 100644 --- a/packages/DApp/src/components/PageBar.tsx +++ b/packages/DApp/src/components/PageBar.tsx @@ -58,7 +58,7 @@ const StyledPageBar = styled.div` z-index: 110; @media (max-width: 900px) { - padding: 24px 32px 16px; + padding: 24px 0 16px; } &.isFixed { diff --git a/packages/DApp/src/components/card/CardCommunity.tsx b/packages/DApp/src/components/card/CardCommunity.tsx index f88f819e..409ea2b 100644 --- a/packages/DApp/src/components/card/CardCommunity.tsx +++ b/packages/DApp/src/components/card/CardCommunity.tsx @@ -70,6 +70,7 @@ export const CardCommunity = ({ community, showRemoveButton, customHeading }: Ca {' '} + {community.directoryInfo && showRemoveButton && setShowRemoveModal(true)} />} @@ -116,15 +117,29 @@ const CommunityInfo = styled.div` ` const CardLogoWrap = styled.div` - width: 64px !important; - height: 64px !important; + width: 64px; + height: 64px; object-fit: cover; margin-right: 16px; + + @media (max-width: 768px) { + display: flex; + flex-direction: column; + justify-content: space-between; + align-items: center; + width: 40px; + height: 76px; + } ` const CardLogo = styled.img` width: 64px !important; height: 64px !important; border-radius: 50%; + + @media (max-width: 768px) { + width: 40px !important; + height: 40px !important; + } ` const CardTop = styled.div` @@ -140,6 +155,17 @@ const RemoveBtn = styled.button` margin-left: 16px; background-image: url(${binIcon}); background-size: cover; + + @media (max-width: 768px) { + display: none; + } +` + +const RemoveBtnMobile = styled(RemoveBtn)` + @media (max-width: 768px) { + display: block; + margin-left: 0; + } ` const CardText = styled.p` diff --git a/packages/DApp/src/components/card/CardVote/CardVote.tsx b/packages/DApp/src/components/card/CardVote/CardVote.tsx index fe5eb41..3053a69 100644 --- a/packages/DApp/src/components/card/CardVote/CardVote.tsx +++ b/packages/DApp/src/components/card/CardVote/CardVote.tsx @@ -96,7 +96,7 @@ export const CardVote = ({ room, hideModalFunction }: CardVoteProps) => { {voteConstants.question} )} - + {winner ? ( finalizeVoting.send(room.roomNumber)} disabled={!account}> @@ -110,6 +110,7 @@ export const CardVote = ({ room, hideModalFunction }: CardVoteProps) => { setSelectedVoted(voteConstants.against) setShowVoteModal(true) }} + style={{ width: hideModalFunction ? '187px' : '305px' }} > {voteConstants.against.text} {voteConstants.against.icon} @@ -119,6 +120,7 @@ export const CardVote = ({ room, hideModalFunction }: CardVoteProps) => { setSelectedVoted(voteConstants.for) setShowVoteModal(true) }} + style={{ width: hideModalFunction ? '187px' : '305px' }} > {voteConstants.for.text} {voteConstants.for.icon} @@ -141,7 +143,7 @@ const CardHeadingEndedVote = styled.p` text-align: center; @media (max-width: 768px) { - display: none; + max-width: 100%; } ` diff --git a/packages/DApp/src/components/votes/VoteChart.tsx b/packages/DApp/src/components/votes/VoteChart.tsx index 60635d9..6040d56 100644 --- a/packages/DApp/src/components/votes/VoteChart.tsx +++ b/packages/DApp/src/components/votes/VoteChart.tsx @@ -14,9 +14,17 @@ export interface VoteChartProps { proposingAmount?: number selectedVote?: VoteType isAnimation?: boolean + tabletMode?: (val: boolean) => void } -export function VoteChart({ vote, voteWinner, proposingAmount, selectedVote, isAnimation }: VoteChartProps) { +export function VoteChart({ + vote, + voteWinner, + proposingAmount, + selectedVote, + isAnimation, + tabletMode, +}: VoteChartProps) { const voteConstants = voteTypes[vote.type] const votesFor = vote.voteFor.toNumber() @@ -51,7 +59,7 @@ export function VoteChart({ vote, voteWinner, proposingAmount, selectedVote, isA SNT - {formatTimeLeft(vote.timeLeft)} + {formatTimeLeft(vote.timeLeft)} {voteConstants.for.icon} @@ -67,7 +75,7 @@ export function VoteChart({ vote, voteWinner, proposingAmount, selectedVote, isA - +
{voteConstants.for.icon} @@ -67,7 +75,7 @@ export function VoteChart({ vote, voteWinner, proposingAmount, selectedVote, isA