From 10ce7a40e86030f5c14e3c77be64a0f6ab404ae5 Mon Sep 17 00:00:00 2001 From: Jaco Greeff Date: Sat, 9 Jan 2021 09:41:13 +0100 Subject: [PATCH] font-weight: 400 -> theme.fontWeightNormal (#4339) * font-weight: 400 -> theme.fontWeightNormal * Less lazy, font-weight: 400 converted --- packages/page-accounts/src/Sidebar/Balances.tsx | 8 +++++--- packages/page-accounts/src/Sidebar/Sidebar.tsx | 2 +- packages/page-accounts/src/modals/Create.tsx | 7 ++++--- packages/page-calendar/src/DayHour.tsx | 4 ++-- packages/page-calendar/src/Month.tsx | 7 ++++--- packages/page-contracts/src/shared/Message.tsx | 7 ++++--- packages/page-contracts/src/shared/MessageSignature.tsx | 4 ++-- packages/page-explorer/src/BlockInfo/Extrinsic.tsx | 7 ++++--- packages/page-poll/src/index.tsx | 9 +++++---- packages/react-components/src/AccountName.tsx | 2 +- packages/react-components/src/AvatarItem.tsx | 8 +++++--- packages/react-components/src/CardSummary.tsx | 2 +- packages/react-components/src/Labelled.tsx | 8 +++++--- packages/react-components/src/Status/index.tsx | 7 ++++--- packages/react-components/src/Table/Foot.tsx | 2 +- packages/react-components/src/Table/Head.tsx | 2 +- packages/react-components/src/Tag.tsx | 8 +++++--- packages/react-components/src/styles/index.ts | 2 +- packages/react-components/src/styles/semantic.ts | 6 +++--- packages/react-signer/src/Transaction.tsx | 7 ++++--- 20 files changed, 62 insertions(+), 47 deletions(-) diff --git a/packages/page-accounts/src/Sidebar/Balances.tsx b/packages/page-accounts/src/Sidebar/Balances.tsx index d258d5e239..1600d3424f 100644 --- a/packages/page-accounts/src/Sidebar/Balances.tsx +++ b/packages/page-accounts/src/Sidebar/Balances.tsx @@ -1,6 +1,8 @@ // Copyright 2017-2021 @polkadot/app-accounts 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'; @@ -38,7 +40,7 @@ function Balances ({ address, className }: Props): React.ReactElement | n ); } -export default React.memo(styled(Balances)` +export default React.memo(styled(Balances)(({ theme }: ThemeProps) => ` .balanceExpander { .column.column--expander { width: auto; @@ -46,7 +48,7 @@ export default React.memo(styled(Balances)` label { color: inherit; font-size: 0.93rem; - font-weight: 400; + font-weight: ${theme.fontWeightNormal}; } .ui--Expander-content .ui--FormatBalance-value { @@ -54,4 +56,4 @@ export default React.memo(styled(Balances)` } } } -`); +`)); diff --git a/packages/page-accounts/src/Sidebar/Sidebar.tsx b/packages/page-accounts/src/Sidebar/Sidebar.tsx index 9b8f8cc549..6f204d67b3 100644 --- a/packages/page-accounts/src/Sidebar/Sidebar.tsx +++ b/packages/page-accounts/src/Sidebar/Sidebar.tsx @@ -217,7 +217,7 @@ export default React.memo(styled(FullSidebar)(({ theme }: ThemeProps) => ` width: 100%; .th { - font-weight: 400; + font-weight: ${theme.fontWeightNormal}; text-align: right; flex-basis: 20%; diff --git a/packages/page-accounts/src/modals/Create.tsx b/packages/page-accounts/src/modals/Create.tsx index 60a1f42369..9a10697654 100644 --- a/packages/page-accounts/src/modals/Create.tsx +++ b/packages/page-accounts/src/modals/Create.tsx @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import type { ActionStatus } from '@polkadot/react-components/Status/types'; +import type { ThemeProps } from '@polkadot/react-components/types'; import type { CreateResult } from '@polkadot/ui-keyring/types'; import type { KeypairType } from '@polkadot/util-crypto/types'; import type { ModalProps } from '../types'; @@ -475,7 +476,7 @@ function Create ({ className = '', onClose, onStatusChange, seed: propsSeed, typ ); } -export default React.memo(styled(Create)` +export default React.memo(styled(Create)(({ theme }: ThemeProps) => ` .accounts--Creator-advanced { margin-top: 1rem; overflow: visible; @@ -503,8 +504,8 @@ export default React.memo(styled(Create)` margin: 0.8rem 0; > label { - font-weight: 400; + font-weight: ${theme.fontWeightNormal}; } } } -`); +`)); diff --git a/packages/page-calendar/src/DayHour.tsx b/packages/page-calendar/src/DayHour.tsx index d907e58c22..e2ffdb9682 100644 --- a/packages/page-calendar/src/DayHour.tsx +++ b/packages/page-calendar/src/DayHour.tsx @@ -76,7 +76,7 @@ export default React.memo(styled(DayHour)(({ theme }: ThemeProps) => ` .hourLabel { flex: 0; font-size: 0.85rem; - font-weight: 400; + font-weight: ${theme.fontWeightNormal}; line-height: 1; min-width: 5.5rem; opacity: 0.5; @@ -88,7 +88,7 @@ export default React.memo(styled(DayHour)(({ theme }: ThemeProps) => ` &.hasItems .hourLabel { font-size: 1.1rem; - font-weight: 400; + font-weight: ${theme.fontWeightNormal}; opacity: 1; padding: 0.7rem 1rem; } diff --git a/packages/page-calendar/src/Month.tsx b/packages/page-calendar/src/Month.tsx index 635081c4e3..7b5d89af30 100644 --- a/packages/page-calendar/src/Month.tsx +++ b/packages/page-calendar/src/Month.tsx @@ -1,6 +1,7 @@ // Copyright 2017-2021 @polkadot/app-calendar authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type { ThemeProps } from '@polkadot/react-components/types'; import type { DateState, EntryInfo } from './types'; import React, { useMemo, useRef } from 'react'; @@ -82,7 +83,7 @@ function Month ({ className, hasNextMonth, lastDay, now, scheduled, setDay, setN ); } -export default React.memo(styled(Month)` +export default React.memo(styled(Month)(({ theme }: ThemeProps) => ` flex: 0; max-width: max-content; @@ -110,7 +111,7 @@ export default React.memo(styled(Month)` .dayOfWeek { > * { font-size: 0.7em; - font-weight: 400; + font-weight: ${theme.fontWeightNormal}; letter-spacing: 0.1em; text-align: center; text-transform: uppercase; @@ -124,4 +125,4 @@ export default React.memo(styled(Month)` justify-content: space-between; } } -`); +`)); diff --git a/packages/page-contracts/src/shared/Message.tsx b/packages/page-contracts/src/shared/Message.tsx index 586e9d7388..bc1a8ea5b9 100644 --- a/packages/page-contracts/src/shared/Message.tsx +++ b/packages/page-contracts/src/shared/Message.tsx @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import type { AbiConstructor, AbiMessage, ContractCallOutcome } from '@polkadot/api-contract/types'; +import type { ThemeProps } from '@polkadot/react-components/types'; import React, { useCallback } from 'react'; import styled from 'styled-components'; @@ -100,7 +101,7 @@ function Message ({ className = '', index, lastResult, message, onSelect }: Prop ); } -export default React.memo(styled(Message)` +export default React.memo(styled(Message)(({ theme }: ThemeProps) => ` align-items: center; border-radius: 0.25rem; display: flex; @@ -118,7 +119,7 @@ export default React.memo(styled(Message)` .docs { font-size: 0.9rem; - font-weight: 400; + font-weight: ${theme.fontWeightNormal}; } } @@ -129,4 +130,4 @@ export default React.memo(styled(Message)` &+& { margin-top: 0.5rem; } -`); +`)); diff --git a/packages/page-contracts/src/shared/MessageSignature.tsx b/packages/page-contracts/src/shared/MessageSignature.tsx index 6d7c763f46..04f1f6635c 100644 --- a/packages/page-contracts/src/shared/MessageSignature.tsx +++ b/packages/page-contracts/src/shared/MessageSignature.tsx @@ -80,7 +80,7 @@ function MessageSignature ({ className, message: { args, identifier, isConstruct export default React.memo(styled(MessageSignature)(({ theme }: ThemeProps) => ` font: ${theme.fontMono}; - font-weight: 400; + font-weight: ${theme.fontWeightNormal}; flex-grow: 1; .ui--MessageSignature-mutates { @@ -91,7 +91,7 @@ export default React.memo(styled(MessageSignature)(({ theme }: ThemeProps) => ` .ui--MessageSignature-name { color: #2f8ddb; - font-weight: 400; + font-weight: ${theme.fontWeightNormal}; } .ui--MessageSignature-type { diff --git a/packages/page-explorer/src/BlockInfo/Extrinsic.tsx b/packages/page-explorer/src/BlockInfo/Extrinsic.tsx index 3da3c1afca..73a17718e0 100644 --- a/packages/page-explorer/src/BlockInfo/Extrinsic.tsx +++ b/packages/page-explorer/src/BlockInfo/Extrinsic.tsx @@ -1,6 +1,7 @@ // Copyright 2017-2021 @polkadot/app-explorer authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type { ThemeProps } from '@polkadot/react-components/types'; import type { KeyedEvent } from '@polkadot/react-query/types'; import type { BlockNumber, Extrinsic } from '@polkadot/types/interfaces'; @@ -102,7 +103,7 @@ function ExtrinsicDisplay ({ blockNumber, className = '', events, index, value } ); } -export default React.memo(styled(ExtrinsicDisplay)` +export default React.memo(styled(ExtrinsicDisplay)(({ theme }: ThemeProps) => ` .explorer--BlockByHash-event+.explorer--BlockByHash-event { margin-top: 0.75rem; } @@ -117,6 +118,6 @@ export default React.memo(styled(ExtrinsicDisplay)` .explorer--BlockByHash-unsigned { opacity: 0.6; - font-weight: 400; + font-weight: ${theme.fontWeightNormal}; } -`); +`)); diff --git a/packages/page-poll/src/index.tsx b/packages/page-poll/src/index.tsx index 386fd3d241..3932bb2c5d 100644 --- a/packages/page-poll/src/index.tsx +++ b/packages/page-poll/src/index.tsx @@ -1,6 +1,7 @@ // Copyright 2017-2021 @polkadot/app-poll authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type { ThemeProps } from '@polkadot/react-components/types'; import type { Approvals, Balance, BlockNumber } from '@polkadot/types/interfaces'; import type { ITuple } from '@polkadot/types/types'; @@ -202,7 +203,7 @@ function PollApp ({ basePath, className }: Props): React.ReactElement { ); } -export default React.memo(styled(PollApp)` +export default React.memo(styled(PollApp)(({ theme }: ThemeProps) => ` .pollActions { opacity: 0.75; } @@ -257,7 +258,7 @@ export default React.memo(styled(PollApp)` .optionName { font-size: 1.2rem; - font-weight: 400; + font-weight: ${theme.fontWeightNormal}; line-height: 1; margin-bottom: 0.75rem; } @@ -287,7 +288,7 @@ export default React.memo(styled(PollApp)` .ui--FormatBalance { font-size: 1.2rem; - font-weight: 400; + font-weight: ${theme.fontWeightNormal}; line-height: 1; } @@ -295,4 +296,4 @@ export default React.memo(styled(PollApp)` margin: 0.75rem; } } -`); +`)); diff --git a/packages/react-components/src/AccountName.tsx b/packages/react-components/src/AccountName.tsx index b3a90fef7a..f0e7a0d183 100644 --- a/packages/react-components/src/AccountName.tsx +++ b/packages/react-components/src/AccountName.tsx @@ -203,7 +203,7 @@ export default React.memo(styled(AccountName)(({ theme }: ThemeProps) => ` .name { align-items: center; display: inline-flex; - font-weight: 400 !important; + font-weight: ${theme.fontWeightNormal} !important; filter: grayscale(100%); line-height: 1; opacity: 0.6; diff --git a/packages/react-components/src/AvatarItem.tsx b/packages/react-components/src/AvatarItem.tsx index 7dd7f7a557..11bfb7b8ac 100644 --- a/packages/react-components/src/AvatarItem.tsx +++ b/packages/react-components/src/AvatarItem.tsx @@ -1,6 +1,8 @@ // Copyright 2017-2021 @polkadot/app-parachains authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type { ThemeProps } from './types'; + import React from 'react'; import styled from 'styled-components'; @@ -33,7 +35,7 @@ function AvatarItem ({ children, className = '', icon, isBig, subtitle, title }: ); } -export default React.memo(styled(AvatarItem)` +export default React.memo(styled(AvatarItem)(({ theme }: ThemeProps) => ` & { display: flex; align-items: center; @@ -66,7 +68,7 @@ export default React.memo(styled(AvatarItem)` flex: 1; .ui--AvatarItem-title { - font-weight: 400; + font-weight: ${theme.fontWeightNormal}; font-size: 1rem; } @@ -96,4 +98,4 @@ export default React.memo(styled(AvatarItem)` } } } -`); +`)); diff --git a/packages/react-components/src/CardSummary.tsx b/packages/react-components/src/CardSummary.tsx index 4ddf93e424..2b7bde00b9 100644 --- a/packages/react-components/src/CardSummary.tsx +++ b/packages/react-components/src/CardSummary.tsx @@ -139,7 +139,7 @@ export default React.memo(styled(CardSummary)(({ theme }: ThemeProps) => ` .isSecondary { font-size: 1rem; - font-weight: 400; + font-weight: ${theme.fontWeightNormal}; .timer { min-width: 8rem; diff --git a/packages/react-components/src/Labelled.tsx b/packages/react-components/src/Labelled.tsx index 289da2527b..b4c06d4735 100644 --- a/packages/react-components/src/Labelled.tsx +++ b/packages/react-components/src/Labelled.tsx @@ -1,6 +1,8 @@ // Copyright 2017-2021 @polkadot/react-components authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type { ThemeProps } from './types'; + import React from 'react'; import styled from 'styled-components'; @@ -45,7 +47,7 @@ function Labelled ({ className = '', children, help, isFull, isHidden, isOuter, ); } -export default React.memo(styled(Labelled)` +export default React.memo(styled(Labelled)(({ theme }: ThemeProps) => ` &.ui--Labelled { display: block; position: relative; @@ -101,7 +103,7 @@ export default React.memo(styled(Labelled)` .labelExtra { color: rgba(78, 78, 78, .85); - font-weight: 400; + font-weight: ${theme.fontWeightNormal}; right: 1.75rem; text-align: right; } @@ -155,4 +157,4 @@ export default React.memo(styled(Labelled)` } } } -`); +`)); diff --git a/packages/react-components/src/Status/index.tsx b/packages/react-components/src/Status/index.tsx index 2dba4e3e5b..deacacdc62 100644 --- a/packages/react-components/src/Status/index.tsx +++ b/packages/react-components/src/Status/index.tsx @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import type { IconName } from '@fortawesome/fontawesome-svg-core'; +import type { ThemeProps } from '../types'; import type { QueueStatus, QueueTx, QueueTxStatus } from './types'; import React, { useCallback, useContext, useEffect, useState } from 'react'; @@ -202,7 +203,7 @@ function Status ({ className = '' }: Props): React.ReactElement | null { ); } -export default React.memo(styled(Status)` +export default React.memo(styled(Status)(({ theme }: ThemeProps) => ` display: inline-block; position: fixed; right: 0.75rem; @@ -239,7 +240,7 @@ export default React.memo(styled(Status)` padding: 0.5rem 1rem; .status { - font-weight: 400; + font-weight: ${theme.fontWeightNormal}; } .ui--AddressMini { @@ -305,4 +306,4 @@ export default React.memo(styled(Status)` } } } -`); +`)); diff --git a/packages/react-components/src/Table/Foot.tsx b/packages/react-components/src/Table/Foot.tsx index 123d1a80d5..cfc5d72fb2 100644 --- a/packages/react-components/src/Table/Foot.tsx +++ b/packages/react-components/src/Table/Foot.tsx @@ -28,7 +28,7 @@ export default React.memo(styled(Foot)(({ theme }: ThemeProps) => ` td { color: rgba(${theme.theme === 'dark' ? '254, 240, 240' : '78, 78, 78'}, 0.66); font: ${theme.fontSans}; - font-weight: 400; + font-weight: ${theme.fontWeightNormal}; padding: 0.75rem 1rem 0.25rem; text-align: right; vertical-align: baseline; diff --git a/packages/react-components/src/Table/Head.tsx b/packages/react-components/src/Table/Head.tsx index e8d5f1e0b4..0d71dbc6e0 100644 --- a/packages/react-components/src/Table/Head.tsx +++ b/packages/react-components/src/Table/Head.tsx @@ -54,7 +54,7 @@ export default React.memo(styled(Head)(({ theme }: ThemeProps) => ` th { font: ${theme.fontSans}; - font-weight: 400; + font-weight: ${theme.fontWeightNormal}; padding: 0.75rem 1rem 0.25rem; text-align: right; vertical-align: baseline; diff --git a/packages/react-components/src/Tag.tsx b/packages/react-components/src/Tag.tsx index 6811297d66..a590951346 100644 --- a/packages/react-components/src/Tag.tsx +++ b/packages/react-components/src/Tag.tsx @@ -1,6 +1,8 @@ // Copyright 2017-2021 @polkadot/react-components authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type { ThemeProps } from './types'; + import React, { useState } from 'react'; import styled from 'styled-components'; @@ -40,12 +42,12 @@ function Tag ({ className = '', color = 'grey', hover, isTag = true, label, size ); } -export default React.memo(styled(Tag)` +export default React.memo(styled(Tag)(({ theme }: ThemeProps) => ` border-radius: 0.25rem; color: #fff; display: inline-block; font-size: 0.78571429rem; - font-weight: 400; + font-weight: ${theme.fontWeightNormal}; line-height: 1; margin: 0.125rem; padding: 0.5833em 0.833em; @@ -115,4 +117,4 @@ export default React.memo(styled(Tag)` transition: none; } } -`); +`)); diff --git a/packages/react-components/src/styles/index.ts b/packages/react-components/src/styles/index.ts index 2255dd3c1f..35b7dbffd2 100644 --- a/packages/react-components/src/styles/index.ts +++ b/packages/react-components/src/styles/index.ts @@ -370,7 +370,7 @@ export default createGlobalStyle(({ theme, uiHighlight }: Pr display: block; font: ${theme.fontSans}; font-size: 1rem; - font-weight: 400; + font-weight: ${theme.fontWeightNormal}; } main { diff --git a/packages/react-components/src/styles/semantic.ts b/packages/react-components/src/styles/semantic.ts index 915946236b..f8bd061441 100644 --- a/packages/react-components/src/styles/semantic.ts +++ b/packages/react-components/src/styles/semantic.ts @@ -117,7 +117,7 @@ export default (theme: ThemeDef): string => ` .ui.label { background: transparent; - font-weight: 400; + font-weight: ${theme.fontWeightNormal}; position: relative; z-index: 1; } @@ -146,7 +146,7 @@ export default (theme: ThemeDef): string => ` color: ${theme.colorSummary}; font: ${theme.fontSans}; font-size: 1.75rem; - font-weight: 400; + font-weight: ${theme.fontWeightNormal}; line-height: 1.25rem; padding: 1.5rem 1.75rem 0; text-transform: lowercase; @@ -158,7 +158,7 @@ export default (theme: ThemeDef): string => ` .description { margin: 1.5em 0; - font-weight: 400; + font-weight: ${theme.fontWeightNormal}; } } diff --git a/packages/react-signer/src/Transaction.tsx b/packages/react-signer/src/Transaction.tsx index b88da4937b..d39da8a762 100644 --- a/packages/react-signer/src/Transaction.tsx +++ b/packages/react-signer/src/Transaction.tsx @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import type { QueueTx } from '@polkadot/react-components/Status/types'; +import type { ThemeProps } from '@polkadot/react-components/types'; import BN from 'bn.js'; import React from 'react'; @@ -61,7 +62,7 @@ function Transaction ({ className, currentItem: { accountId, extrinsic, isUnsign ); } -export default React.memo(styled(Transaction)` +export default React.memo(styled(Transaction)(({ theme }: ThemeProps) => ` .tx-details { .ui--Expander-summary { font-size: 1.1rem; @@ -69,7 +70,7 @@ export default React.memo(styled(Transaction)` } .highlight { - font-weight: 400; + font-weight: ${theme.fontWeightNormal}; } .meta { @@ -81,4 +82,4 @@ export default React.memo(styled(Transaction)` opacity: 0.6; } } -`); +`));