From 2f572b68c5b660038f690053adb309b67ff685ab Mon Sep 17 00:00:00 2001 From: Jaco Date: Mon, 3 May 2021 10:18:17 +0300 Subject: [PATCH] Bounty display alignment (#5191) --- packages/page-bounties/src/Bounty.tsx | 18 +++++++----------- .../src/BountyInfos/VotingSummary.tsx | 8 +++----- .../src/BountyNextActionInfo/BountyInfo.tsx | 7 ++++--- packages/page-bounties/src/Description.tsx | 10 +++------- packages/page-bounties/src/VotersColumn.tsx | 8 +++----- packages/page-bounties/src/theme.ts | 5 ----- packages/react-components/src/Table/index.tsx | 2 +- 7 files changed, 21 insertions(+), 37 deletions(-) diff --git a/packages/page-bounties/src/Bounty.tsx b/packages/page-bounties/src/Bounty.tsx index 3d8424e6b8..8c95b885ed 100644 --- a/packages/page-bounties/src/Bounty.tsx +++ b/packages/page-bounties/src/Bounty.tsx @@ -8,7 +8,6 @@ import React, { useCallback, useMemo, useState } from 'react'; import styled from 'styled-components'; import { AddressSmall, Icon, LinkExternal } from '@polkadot/react-components'; -import { ThemeProps } from '@polkadot/react-components/types'; import { FormatBalance } from '@polkadot/react-query'; import { formatNumber } from '@polkadot/util'; @@ -21,7 +20,6 @@ import BountyStatusView from './BountyStatusView'; import Curator from './Curator'; import DueBlocks from './DueBlocks'; import { useBountyStatus } from './hooks'; -import { bountyLabelColor } from './theme'; import { useTranslation } from './translate'; import VotersColumn from './VotersColumn'; @@ -200,7 +198,7 @@ function Bounty ({ bestNumber, bounty, className = '', description, index, isEve ); } -export default React.memo(styled(Bounty)(({ theme }: ThemeProps) => ` +export default React.memo(styled(Bounty)` &.isCollapsed { visibility: collapse; } @@ -258,11 +256,9 @@ export default React.memo(styled(Bounty)(({ theme }: ThemeProps) => ` .label { text-align: right; padding: 0 1.7rem 0 0; - font-weight: 500; - font-size: 0.7rem; line-height: normal; - color: ${bountyLabelColor[theme.theme]}; - text-transform: uppercase; + color: var(--color-label); + text-transform: lowercase; } .label-column-right, .label-column-left{ @@ -275,11 +271,11 @@ export default React.memo(styled(Bounty)(({ theme }: ThemeProps) => ` } .label-column-right { - padding: 0 0 0.75rem; + padding: 0 0 0.5rem; } .label-column-left { - padding: 0 0 0.75rem; + padding: 0 0 0.5rem; } & .td-info-action-row { @@ -309,11 +305,11 @@ export default React.memo(styled(Bounty)(({ theme }: ThemeProps) => ` .block-to-time { font-size: 0.7rem; line-height: 1.5rem; - color: ${bountyLabelColor[theme.theme]}; + color: var(--color-label); } & .votes-table { display: flex; justify-content: space-between; } -`)); +`); diff --git a/packages/page-bounties/src/BountyInfos/VotingSummary.tsx b/packages/page-bounties/src/BountyInfos/VotingSummary.tsx index 9e1a7a3bf7..4e4f7f9d5a 100644 --- a/packages/page-bounties/src/BountyInfos/VotingSummary.tsx +++ b/packages/page-bounties/src/BountyInfos/VotingSummary.tsx @@ -8,10 +8,8 @@ import React, { useMemo } from 'react'; import styled from 'styled-components'; import VotingDescriptionInfo from '@polkadot/app-bounties/BountyInfos/VotingDescriptionInfo'; -import { ThemeProps } from '@polkadot/react-components/types'; import { useMembers } from '@polkadot/react-hooks'; -import { bountyLabelColor } from '../theme'; import { useTranslation } from '../translate'; import VotingLink from './VotingLink'; @@ -51,11 +49,11 @@ function VotingSummary ({ className, proposal, status }: Props): JSX.Element { ); } -export default React.memo(styled(VotingSummary)(({ theme }: ThemeProps) => ` +export default React.memo(styled(VotingSummary)` .voting-summary-text { font-size: 0.85rem; line-height: 1.5rem; - color: ${bountyLabelColor[theme.theme]} + color: var(--color-label); span { min-width: 0.5rem; @@ -69,4 +67,4 @@ export default React.memo(styled(VotingSummary)(({ theme }: ThemeProps) => ` align-items: center; line-height: 1.5rem; } -`)); +`); diff --git a/packages/page-bounties/src/BountyNextActionInfo/BountyInfo.tsx b/packages/page-bounties/src/BountyNextActionInfo/BountyInfo.tsx index 1959607d43..b8be1f43e8 100644 --- a/packages/page-bounties/src/BountyNextActionInfo/BountyInfo.tsx +++ b/packages/page-bounties/src/BountyNextActionInfo/BountyInfo.tsx @@ -1,13 +1,14 @@ // Copyright 2017-2021 @polkadot/app-bounties authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type { ThemeProps } from '@polkadot/react-components/types'; + import React from 'react'; import styled from 'styled-components'; import { Icon } from '@polkadot/react-components'; -import { ThemeProps } from '@polkadot/react-components/types'; -import { bountyLabelColor, bountySvgColor } from '../theme'; +import { bountySvgColor } from '../theme'; interface Props { className: ''; @@ -48,7 +49,7 @@ export default React.memo(styled(BountyInfo)(({ theme }: ThemeProps) => ` font-weight: 400; font-size: 0.714rem; line-height: 0.864rem; - color: ${bountyLabelColor[theme.theme]}; + color: var(--color-label); word-wrap: break-word; } `)); diff --git a/packages/page-bounties/src/Description.tsx b/packages/page-bounties/src/Description.tsx index 9c5b9be677..8fe0874b03 100644 --- a/packages/page-bounties/src/Description.tsx +++ b/packages/page-bounties/src/Description.tsx @@ -4,10 +4,6 @@ import React from 'react'; import styled from 'styled-components'; -import { ThemeProps } from '@polkadot/react-components/types'; - -import { bountyLabelColor } from './theme'; - interface Props { className?: string; dataTestId?: string; @@ -24,9 +20,9 @@ function Description ({ className = '', dataTestId = '', description }: Props): ); } -export default React.memo(styled(Description)(({ theme }: ThemeProps) => ` +export default React.memo(styled(Description)` margin-top: 0.28rem; font-size: 0.7rem; line-height: 0.85rem; - color: ${bountyLabelColor[theme.theme]}; -`)); + color: var(--color-label); +`); diff --git a/packages/page-bounties/src/VotersColumn.tsx b/packages/page-bounties/src/VotersColumn.tsx index 73ef3068cc..71b8b61215 100644 --- a/packages/page-bounties/src/VotersColumn.tsx +++ b/packages/page-bounties/src/VotersColumn.tsx @@ -8,10 +8,8 @@ import React, { useMemo } from 'react'; import styled from 'styled-components'; import { AddressSmall, Icon } from '@polkadot/react-components'; -import { ThemeProps } from '@polkadot/react-components/types'; import { getProposalToDisplay } from './helpers/extendedStatuses'; -import { bountyLabelColor } from './theme'; import { useTranslation } from './translate'; interface Props { @@ -58,7 +56,7 @@ function VotersColumn ({ className, option, proposals, status }: Props): React.R ); } -export default React.memo(styled(VotersColumn)(({ theme }: ThemeProps) => ` +export default React.memo(styled(VotersColumn)` width: 50%; .vote-numbers { @@ -69,7 +67,7 @@ export default React.memo(styled(VotersColumn)(({ theme }: ThemeProps) => ` .vote-numbers-icon svg { max-width: 10px; - color: ${bountyLabelColor[theme.theme]}; + color: var(--color-label); } .vote-numbers-label { @@ -80,4 +78,4 @@ export default React.memo(styled(VotersColumn)(({ theme }: ThemeProps) => ` text-transform: uppercase; color: var(--color-label); } -`)); +`); diff --git a/packages/page-bounties/src/theme.ts b/packages/page-bounties/src/theme.ts index 466f872ace..91da78a34b 100644 --- a/packages/page-bounties/src/theme.ts +++ b/packages/page-bounties/src/theme.ts @@ -6,11 +6,6 @@ type bountyTheme = { light: string; } -export const bountyLabelColor: bountyTheme = { - dark: '#757575', - light: '#8B8B8B' -}; - export const bountySvgColor: bountyTheme = { dark: '#8E8E8E', light: '#4D4D4D' diff --git a/packages/react-components/src/Table/index.tsx b/packages/react-components/src/Table/index.tsx index 7548127977..7fcb657515 100644 --- a/packages/react-components/src/Table/index.tsx +++ b/packages/react-components/src/Table/index.tsx @@ -68,7 +68,7 @@ export default React.memo(styled(Table)` table { border-spacing: 0; max-width: 100%; - overflow-x: hidden; + overflow: hidden; position: relative; width: 100%; z-index: 1;