From f683da30cbcc79c32879cec6493435a3ac6b3598 Mon Sep 17 00:00:00 2001 From: Jaco Date: Tue, 3 Jan 2023 13:49:50 +0200 Subject: [PATCH] Apply media queries on referenda (#8679) --- .../src/Referenda/Deposits/index.tsx | 29 +++-- .../page-referenda/src/Referenda/Group.tsx | 7 +- .../src/Referenda/RefOngoing.tsx | 2 +- .../page-referenda/src/Referenda/RefTuple.tsx | 1 + .../page-referenda/src/Referenda/Summary.tsx | 10 +- .../page-referenda/src/Referenda/Votes.tsx | 2 +- .../page-referenda/src/Referenda/index.tsx | 2 +- packages/react-components/src/styles/media.ts | 108 ++---------------- 8 files changed, 44 insertions(+), 117 deletions(-) diff --git a/packages/page-referenda/src/Referenda/Deposits/index.tsx b/packages/page-referenda/src/Referenda/Deposits/index.tsx index 4e1dfc9fc3..757de6b0e6 100644 --- a/packages/page-referenda/src/Referenda/Deposits/index.tsx +++ b/packages/page-referenda/src/Referenda/Deposits/index.tsx @@ -19,17 +19,19 @@ interface Props { className?: string; decision: PalletReferendaDeposit | null; id: BN; + noMedia?: boolean; palletReferenda: PalletReferenda; submit: PalletReferendaDeposit | null; track?: PalletReferendaTrackInfo; } -function Deposits ({ canDeposit, canRefund, className = '', decision, id, palletReferenda, submit, track }: Props): React.ReactElement { +function Deposits ({ canDeposit, canRefund, className = '', decision, id, noMedia, palletReferenda, submit, track }: Props): React.ReactElement { return ( - + {submit && ( @@ -39,23 +41,28 @@ function Deposits ({ canDeposit, canRefund, className = '', decision, id, pallet <> {canRefund && ( - +
+ +
)} ) : canDeposit && track && ( - +
+ +
) } diff --git a/packages/page-referenda/src/Referenda/Group.tsx b/packages/page-referenda/src/Referenda/Group.tsx index 033d47c91f..d6352adbd3 100644 --- a/packages/page-referenda/src/Referenda/Group.tsx +++ b/packages/page-referenda/src/Referenda/Group.tsx @@ -45,7 +45,7 @@ function Group ({ activeIssuance, className, isMember, members, palletReferenda, ), isExpanded && trackInfo && ( - + ) ], @@ -55,9 +55,8 @@ function Group ({ activeIssuance, className, isMember, members, palletReferenda, const [header, key] = useMemo( () => [ [ - [trackName ? <>{trackName}
{trackInfo?.text}
: t('referenda'), 'start', 5], - [undefined, 'number', 2], - [headerButton] + [trackName ? <>{trackName}
{trackInfo?.text}
: t('referenda'), 'start', 8], + null && [headerButton] ], trackName ? `track:${trackName}` diff --git a/packages/page-referenda/src/Referenda/RefOngoing.tsx b/packages/page-referenda/src/Referenda/RefOngoing.tsx index e46489a56a..137f09ae30 100644 --- a/packages/page-referenda/src/Referenda/RefOngoing.tsx +++ b/packages/page-referenda/src/Referenda/RefOngoing.tsx @@ -124,7 +124,7 @@ function Ongoing ({ isMember, members, palletReferenda, palletVote, ranks, track palletVote={palletVote} tally={tally} /> - + )} {issuanceInactive && ( - ('inactive issuance')}> + ('inactive issuance')} + > )} {issuanceActive && issuanceInactive && ( - ('active issuance')}> + ('active issuance')} + > + ('selected track')} onChange={setTrackSelected} options={trackOpts} diff --git a/packages/react-components/src/styles/media.ts b/packages/react-components/src/styles/media.ts index 2cd2493f54..66e86c697b 100644 --- a/packages/react-components/src/styles/media.ts +++ b/packages/react-components/src/styles/media.ts @@ -1,106 +1,20 @@ // Copyright 2017-2023 @polkadot/react-components authors & contributors // SPDX-License-Identifier: Apache-2.0 -export default ` - .media--2000 { - @media only screen and (max-width: 2000px) { +export default [ + '2000', '1900', '1800', '1700', '1600', '1500', '1400', '1300', '1200', '1100', + '1000', '900', '800', '700', '600', '500', '400' +].map((size) => ` + .media--${size} { + @media only screen and (max-width: ${size}px) { display: none !important; } } - .media--1900 { - @media only screen and (max-width: 1900px) { - display: none !important; + .media--${size}-noPad { + @media only screen and (max-width: ${size}px) { + min-width: 0 !important; + padding: 0 !important; } } - - .media--1800 { - @media only screen and (max-width: 1800px) { - display: none !important; - } - } - - .media--1700 { - @media only screen and (max-width: 1700px) { - display: none !important; - } - } - - .media--1600 { - @media only screen and (max-width: 1600px) { - display: none !important; - } - } - - .media--1500 { - @media only screen and (max-width: 1500px) { - display: none !important; - } - } - - .media--1400 { - @media only screen and (max-width: 1400px) { - display: none !important; - } - } - - .media--1300 { - @media only screen and (max-width: 1300px) { - display: none !important; - } - } - - .media--1200 { - @media only screen and (max-width: 1200px) { - display: none !important; - } - } - - .media--1100 { - @media only screen and (max-width: 1100px) { - display: none !important; - } - } - - .media--1000 { - @media only screen and (max-width: 1000px) { - display: none !important; - } - } - - .media--900 { - @media only screen and (max-width: 900px) { - display: none !important; - } - } - - .media--800 { - @media only screen and (max-width: 800px) { - display: none !important; - } - } - - .media--700 { - @media only screen and (max-width: 700px) { - display: none !important; - } - } - - .media--600 { - @media only screen and (max-width: 600px) { - display: none !important; - } - } - - .media--500 { - @media only screen and (max-width: 500px) { - display: none !important; - } - } - - .media--400 { - @media only screen and (max-width: 400px) { - display: none !important; - } - } -`; +`).join('');