Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A0: Improve styled components debugging #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,19 @@
"singleReturnOnly": false
}
],
"react/prop-types": "off"
"react/prop-types": "off",
"no-restricted-imports": [
"error",
{
"paths": [{
"name": "styled-components",
"message": "Please import from styled-components/macro to enable dev tooling."
}],
"patterns": [
"!styled-components/macro"
]
}
]
},
"settings": {
"import/resolver": {
Expand Down
5 changes: 5 additions & 0 deletions babel-plugin-macros.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
styledComponents: {
displayName: process.env.NODE_ENV !== 'production'
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turning off the readable names on production - I guess we better not disclose internal, dev details so openly.

}
}
2 changes: 1 addition & 1 deletion src/Providers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { UIProvider } from 'contexts/UI';
import { ValidatorsProvider } from 'contexts/Validators';
import { withProviders } from 'library/Hooks';
import Router from 'Router';
import { ThemeProvider } from 'styled-components';
import { ThemeProvider } from 'styled-components/macro';
import { EntryWrapper as Wrapper } from 'Wrappers';

// `polkadot-dashboard-ui` theme classes are inserted here.
Expand Down
2 changes: 1 addition & 1 deletion src/Wrappers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
SideMenuStickyThreshold,
} from 'consts';
import { motion } from 'framer-motion';
import styled from 'styled-components';
import styled from 'styled-components/macro';
import {
backgroundGradient,
backgroundPrimary,
Expand Down
2 changes: 1 addition & 1 deletion src/library/Account/Wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

import { motion } from 'framer-motion';
import styled from 'styled-components';
import styled from 'styled-components/macro';
import { borderPrimary, borderSecondary, textSecondary } from 'theme';

export const Wrapper = styled(motion.button)<any>`
Expand Down
2 changes: 1 addition & 1 deletion src/library/ErrorBoundary/Wrapper.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2022 @paritytech/polkadot-staking-dashboard authors & contributors
// SPDX-License-Identifier: Apache-2.0

import styled from 'styled-components';
import styled from 'styled-components/macro';
import { textSecondary } from 'theme';

export const Wrapper = styled.div`
Expand Down
2 changes: 1 addition & 1 deletion src/library/EstimatedTxFee/Wrapper.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2022 @paritytech/polkadot-staking-dashboard authors & contributors
// SPDX-License-Identifier: Apache-2.0

import styled from 'styled-components';
import styled from 'styled-components/macro';
import { textSecondary } from 'theme';

export const Wrapper = styled.div`
Expand Down
2 changes: 1 addition & 1 deletion src/library/Filter/Wrappers.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2022 @paritytech/polkadot-staking-dashboard authors & contributors
// SPDX-License-Identifier: Apache-2.0

import styled from 'styled-components';
import styled from 'styled-components/macro';
import {
borderPrimary,
buttonPrimaryBackground,
Expand Down
2 changes: 1 addition & 1 deletion src/library/Form/AccountDropdown/Wrappers.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2022 @paritytech/polkadot-staking-dashboard authors & contributors
// SPDX-License-Identifier: Apache-2.0

import styled from 'styled-components';
import styled from 'styled-components/macro';
import {
backgroundDropdown,
borderPrimary,
Expand Down
2 changes: 1 addition & 1 deletion src/library/Form/AccountSelect/Wrappers.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2022 @paritytech/polkadot-staking-dashboard authors & contributors
// SPDX-License-Identifier: Apache-2.0

import styled from 'styled-components';
import styled from 'styled-components/macro';
import { backgroundToggle, borderPrimary, textPrimary } from 'theme';

export const StyledDownshift = styled.div<any>`
Expand Down
2 changes: 1 addition & 1 deletion src/library/Form/CreatePoolStatusBar/Wrapper.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2022 @paritytech/polkadot-staking-dashboard authors & contributors
// SPDX-License-Identifier: Apache-2.0

import styled from 'styled-components';
import styled from 'styled-components/macro';
import { backgroundLabel, networkColor, textSecondary } from 'theme';

export const Wrapper = styled.div`
Expand Down
2 changes: 1 addition & 1 deletion src/library/Form/NominateStatusBar/Wrapper.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2022 @paritytech/polkadot-staking-dashboard authors & contributors
// SPDX-License-Identifier: Apache-2.0

import styled from 'styled-components';
import styled from 'styled-components/macro';
import { backgroundLabel, networkColor, textSecondary } from 'theme';

export const Wrapper = styled.div`
Expand Down
2 changes: 1 addition & 1 deletion src/library/Form/Warning/Wrapper.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2022 @paritytech/polkadot-staking-dashboard authors & contributors
// SPDX-License-Identifier: Apache-2.0

import styled from 'styled-components';
import styled from 'styled-components/macro';
import { backgroundLabel } from 'theme';

export const Wrapper = styled.div`
Expand Down
2 changes: 1 addition & 1 deletion src/library/Form/Wrappers.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2022 @paritytech/polkadot-staking-dashboard authors & contributors
// SPDX-License-Identifier: Apache-2.0

import styled from 'styled-components';
import styled from 'styled-components/macro';
import { borderPrimary, textSecondary } from 'theme';

export const Spacer = styled.div`
Expand Down
2 changes: 1 addition & 1 deletion src/library/GenerateNominations/Wrappers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

import { SectionFullWidthThreshold } from 'consts';
import styled from 'styled-components';
import styled from 'styled-components/macro';

export const GenerateOptionsWrapper = styled.div`
width: 100%;
Expand Down
2 changes: 1 addition & 1 deletion src/library/Graphs/Wrappers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

import { SideMenuStickyThreshold } from 'consts';
import styled from 'styled-components';
import styled from 'styled-components/macro';
import {
backgroundSecondary,
borderPrimary,
Expand Down
2 changes: 1 addition & 1 deletion src/library/Headers/Spinner.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2022 @paritytech/polkadot-staking-dashboard authors & contributors
// SPDX-License-Identifier: Apache-2.0

import styled from 'styled-components';
import styled from 'styled-components/macro';
import { backgroundPrimary } from 'theme';

const StyledSpinner = styled.div`
Expand Down
2 changes: 1 addition & 1 deletion src/library/Headers/Wrappers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
SideMenuStickyThreshold,
} from 'consts';
import { motion } from 'framer-motion';
import styled from 'styled-components';
import styled from 'styled-components/macro';
import {
borderPrimary,
buttonSecondaryBackground,
Expand Down
2 changes: 1 addition & 1 deletion src/library/Help/Wrappers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

import { motion } from 'framer-motion';
import styled from 'styled-components';
import styled from 'styled-components/macro';
import {
helpButton,
modalOverlayBackground,
Expand Down
2 changes: 1 addition & 1 deletion src/library/Identicon/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

import { Identicon as IdenticonDefault } from '@polkadot/react-identicon';
import styled from 'styled-components';
import styled from 'styled-components/macro';
import { backgroundIdenticon } from 'theme';
import { IdenticonProps } from './types';

Expand Down
2 changes: 1 addition & 1 deletion src/library/List/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2022 @paritytech/polkadot-staking-dashboard authors & contributors
// SPDX-License-Identifier: Apache-2.0

import styled from 'styled-components';
import styled from 'styled-components/macro';
import { borderPrimary, networkColor, textPrimary, textSecondary } from 'theme';
import { ListProps, PaginationWrapperProps } from './types';

Expand Down
2 changes: 1 addition & 1 deletion src/library/ListItem/Labels/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { IconProp } from '@fortawesome/fontawesome-svg-core';
import { faCheck, faCircle } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { SelectSingleWrapper, SelectWrapper } from 'library/ListItem/Wrappers';
import { useTheme } from 'styled-components';
import { useTheme } from 'styled-components/macro';
import { defaultThemes } from 'theme/default';
import { useList } from '../../List/context';
import { SelectProps } from '../types';
Expand Down
2 changes: 1 addition & 1 deletion src/library/ListItem/Wrappers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import { SmallFontSizeMaxWidth } from 'consts';
import { motion } from 'framer-motion';
import styled from 'styled-components';
import styled from 'styled-components/macro';
import {
backgroundDropdown,
backgroundModalItem,
Expand Down
2 changes: 1 addition & 1 deletion src/library/Menu/Wrappers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

import { FloatingMenuWidth } from 'consts';
import styled from 'styled-components';
import styled from 'styled-components/macro';
import { borderPrimary, modalBackground, textSecondary } from 'theme';

export const Wrapper = styled.div`
Expand Down
2 changes: 1 addition & 1 deletion src/library/Modal/Wrappers.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2022 @paritytech/polkadot-staking-dashboard authors & contributors
// SPDX-License-Identifier: Apache-2.0

import styled from 'styled-components';
import styled from 'styled-components/macro';
import { borderPrimary, textPrimary, textSecondary } from 'theme';

export const TitleWrapper = styled.div<{ fixed: boolean }>`
Expand Down
2 changes: 1 addition & 1 deletion src/library/NetworkBar/Wrappers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import { SideMenuStickyThreshold } from 'consts';
import { motion } from 'framer-motion';
import styled from 'styled-components';
import styled from 'styled-components/macro';
import { backgroundNetworkBar, networkColor, textSecondary } from 'theme';

export const Wrapper = styled(motion.div)`
Expand Down
2 changes: 1 addition & 1 deletion src/library/Notifications/Wrapper.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2022 @paritytech/polkadot-staking-dashboard authors & contributors
// SPDX-License-Identifier: Apache-2.0

import styled from 'styled-components';
import styled from 'styled-components/macro';
import {
backgroundError,
backgroundSuccess,
Expand Down
2 changes: 1 addition & 1 deletion src/library/OpenHelpIcon/Wrapper.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2022 @paritytech/polkadot-staking-dashboard authors & contributors
// SPDX-License-Identifier: Apache-2.0

import styled from 'styled-components';
import styled from 'styled-components/macro';
import {
buttonHelpBackground,
buttonPrimaryBackground,
Expand Down
2 changes: 1 addition & 1 deletion src/library/Overlay/Wrappers.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2022 @paritytech/polkadot-staking-dashboard authors & contributors
// SPDX-License-Identifier: Apache-2.0

import styled from 'styled-components';
import styled from 'styled-components/macro';
import {
buttonPrimaryBackground,
cardShadow,
Expand Down
2 changes: 1 addition & 1 deletion src/library/PoolAccount/Wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

import { motion } from 'framer-motion';
import styled from 'styled-components';
import styled from 'styled-components/macro';
import { borderSecondary, textSecondary } from 'theme';
import { WrapperProps } from './types';

Expand Down
2 changes: 1 addition & 1 deletion src/library/SetupSteps/Footer/Wrapper.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2022 @paritytech/polkadot-staking-dashboard authors & contributors
// SPDX-License-Identifier: Apache-2.0

import styled from 'styled-components';
import styled from 'styled-components/macro';

export const Wrapper = styled.div`
width: 100%;
Expand Down
2 changes: 1 addition & 1 deletion src/library/SetupSteps/Header/Wrapper.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2022 @paritytech/polkadot-staking-dashboard authors & contributors
// SPDX-License-Identifier: Apache-2.0

import styled from 'styled-components';
import styled from 'styled-components/macro';
import { networkColor, textSecondary } from 'theme';

export const Wrapper = styled.div`
Expand Down
2 changes: 1 addition & 1 deletion src/library/SideMenu/Heading/Wrapper.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2022 @paritytech/polkadot-staking-dashboard authors & contributors
// SPDX-License-Identifier: Apache-2.0

import styled from 'styled-components';
import styled from 'styled-components/macro';
import { textSecondary } from 'theme';

export const Wrapper = styled.div<{ minimised: number }>`
Expand Down
2 changes: 1 addition & 1 deletion src/library/SideMenu/Primary/Wrappers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

import { motion } from 'framer-motion';
import styled from 'styled-components';
import styled from 'styled-components/macro';
import {
highlightPrimary,
highlightSecondary,
Expand Down
2 changes: 1 addition & 1 deletion src/library/SideMenu/Secondary/Wrappers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

import { motion } from 'framer-motion';
import styled from 'styled-components';
import styled from 'styled-components/macro';
import {
borderPrimary,
highlightPrimary,
Expand Down
2 changes: 1 addition & 1 deletion src/library/SideMenu/Wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
SideMenuMinimisedWidth,
SideMenuStickyThreshold,
} from 'consts';
import styled from 'styled-components';
import styled from 'styled-components/macro';
import {
backgroundOverlay,
borderPrimary,
Expand Down
2 changes: 1 addition & 1 deletion src/library/Stat/Wrapper.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2022 @paritytech/polkadot-staking-dashboard authors & contributors
// SPDX-License-Identifier: Apache-2.0

import styled from 'styled-components';
import styled from 'styled-components/macro';

export const Wrapper = styled.div`
padding: 0.15rem 0.25rem;
Expand Down
2 changes: 1 addition & 1 deletion src/library/StatBoxList/Wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

import { motion } from 'framer-motion';
import styled from 'styled-components';
import styled from 'styled-components/macro';

import {
backgroundSecondary,
Expand Down
2 changes: 1 addition & 1 deletion src/library/StatusButton/Wrapper.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2022 @paritytech/polkadot-staking-dashboard authors & contributors
// SPDX-License-Identifier: Apache-2.0

import styled from 'styled-components';
import styled from 'styled-components/macro';
import { buttonPrimaryBackground, textPrimary, textSecondary } from 'theme';

export const Wrapper = styled.button`
Expand Down
2 changes: 1 addition & 1 deletion src/library/StatusLabel/Wrapper.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2022 @paritytech/polkadot-staking-dashboard authors & contributors
// SPDX-License-Identifier: Apache-2.0

import styled from 'styled-components';
import styled from 'styled-components/macro';
import { backgroundLabel, textSecondary } from 'theme';
import { WrapperProps } from './types';

Expand Down
2 changes: 1 addition & 1 deletion src/library/SubscanButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { useApi } from 'contexts/Api';
import { useTheme } from 'contexts/Themes';
import { useUi } from 'contexts/UI';
import styled from 'styled-components';
import styled from 'styled-components/macro';
import { defaultThemes, networkColors } from 'theme/default';
import { WrapperProps } from './types';

Expand Down
2 changes: 1 addition & 1 deletion src/library/Tips/Wrappers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

import { motion } from 'framer-motion';
import styled from 'styled-components';
import styled from 'styled-components/macro';
import { helpButton, textPrimary, textSecondary } from 'theme';

export const TipWrapper = styled(motion.div)`
Expand Down
2 changes: 1 addition & 1 deletion src/library/Tooltip/Wrapper.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2022 @paritytech/polkadot-staking-dashboard authors & contributors
// SPDX-License-Identifier: Apache-2.0

import styled from 'styled-components';
import styled from 'styled-components/macro';
import { textInvert, tooltipBackground } from 'theme';

export const Wrapper = styled.div`
Expand Down
Loading