Skip to content

Commit

Permalink
feat(component): use new theme package
Browse files Browse the repository at this point in the history
BREAKING CHANGE: theme now lives in its own package
`@bigcommerce/big-design-theme` if you are using `createTheme`,
`addValues`, `defaultTheme`, `remCalc`, `ThemeInterface` you will now
need to import it from the new package.
  • Loading branch information
deini committed Jul 25, 2019
1 parent f2b6253 commit 4da89f0
Show file tree
Hide file tree
Showing 61 changed files with 43 additions and 531 deletions.
1 change: 1 addition & 0 deletions packages/big-design/package.json
Expand Up @@ -54,6 +54,7 @@
"@babel/preset-react": "^7.0.0",
"@babel/preset-typescript": "^7.1.0",
"@bigcommerce/configs": "^0.5.0",
"@bigcommerce/big-design-theme": "^0.0.1",
"@svgr/cli": "^4.3.2",
"@testing-library/jest-dom": "^4.0.0",
"@testing-library/react": "^8.0.5",
Expand Down
4 changes: 1 addition & 3 deletions packages/big-design/src/components/Box/Box.tsx
@@ -1,9 +1,7 @@
import { Border, BorderRadius, Colors, Elevation } from '@bigcommerce/big-design-theme';
import React from 'react';

import { MarginProps, PaddingProps } from '../../mixins';
import { Border, BorderRadius } from '../../theme/system/border';
import { Colors } from '../../theme/system/colors';
import { Elevation } from '../../theme/system/elevation';

import { StyledBox } from './styled';

Expand Down
2 changes: 1 addition & 1 deletion packages/big-design/src/components/Box/styled.tsx
@@ -1,7 +1,7 @@
import { theme as defaultTheme } from '@bigcommerce/big-design-theme';
import styled, { css } from 'styled-components';

import { withMargins, withPaddings } from '../../mixins';
import { defaultTheme } from '../../theme';

import { BoxProps } from './Box';

Expand Down
2 changes: 1 addition & 1 deletion packages/big-design/src/components/Button/Button.tsx
@@ -1,7 +1,7 @@
import { ThemeInterface } from '@bigcommerce/big-design-theme';
import React, { Ref } from 'react';

import { MarginProps } from '../../mixins';
import { ThemeInterface } from '../../theme';
import { Spinner } from '../Spinner';

import { ContentWrapper, StyledButton } from './styled';
Expand Down
3 changes: 1 addition & 2 deletions packages/big-design/src/components/Button/styled.tsx
@@ -1,8 +1,7 @@
import { addValues, theme as defaultTheme } from '@bigcommerce/big-design-theme';
import styled, { css } from 'styled-components';

import { withMargins, MarginProps } from '../../mixins';
import { defaultTheme } from '../../theme';
import { addValues } from '../../theme/helpers/helpers';

import { ButtonProps } from './index';

Expand Down
2 changes: 1 addition & 1 deletion packages/big-design/src/components/Checkbox/styled.tsx
@@ -1,7 +1,7 @@
import { theme as defaultTheme } from '@bigcommerce/big-design-theme';
import { hideVisually } from 'polished';
import styled, { DefaultTheme, StyledComponent } from 'styled-components';

import { defaultTheme } from '../../theme';
import { StyleableText } from '../Typography/private';

interface StyledCheckboxProps {
Expand Down
2 changes: 1 addition & 1 deletion packages/big-design/src/components/Flex/Item/styled.tsx
@@ -1,6 +1,6 @@
import { theme as defaultTheme } from '@bigcommerce/big-design-theme';
import styled from 'styled-components';

import { defaultTheme } from '../../../theme';
import { Box } from '../../Box';

import { FlexItemProps } from './Item';
Expand Down
2 changes: 1 addition & 1 deletion packages/big-design/src/components/Flex/styled.tsx
@@ -1,6 +1,6 @@
import { theme as defaultTheme } from '@bigcommerce/big-design-theme';
import styled from 'styled-components';

import { defaultTheme } from '../../theme';
import { Box } from '../Box';

import { FlexProps } from './Flex';
Expand Down
2 changes: 1 addition & 1 deletion packages/big-design/src/components/Form/Error/styled.tsx
@@ -1,6 +1,6 @@
import { theme as defaultTheme } from '@bigcommerce/big-design-theme';
import styled from 'styled-components';

import { defaultTheme } from '../../../theme';
import { StyleableSmall } from '../../Typography/private';

export const StyledError = styled(StyleableSmall)`
Expand Down
@@ -1,6 +1,6 @@
import { theme as defaultTheme } from '@bigcommerce/big-design-theme';
import styled, { DefaultTheme, StyledComponent } from 'styled-components';

import { defaultTheme } from '../../../theme';
import { StyleableH3, StyleableSmall } from '../../Typography/private';

export const StyledFieldset = styled.fieldset`
Expand Down
2 changes: 1 addition & 1 deletion packages/big-design/src/components/Form/Label/styled.tsx
@@ -1,6 +1,6 @@
import { theme as defaultTheme } from '@bigcommerce/big-design-theme';
import styled, { DefaultTheme, StyledComponent } from 'styled-components';

import { defaultTheme } from '../../../theme';
import { StyleableH4 } from '../../Typography/private';

import { LabelProps } from './Label';
Expand Down
2 changes: 1 addition & 1 deletion packages/big-design/src/components/Form/Row/styled.tsx
@@ -1,6 +1,6 @@
import { remCalc, theme as defaultTheme } from '@bigcommerce/big-design-theme';
import styled, { css } from 'styled-components';

import { defaultTheme, remCalc } from '../../../theme';
import { StyledInputWrapper } from '../../Input/styled';
import { StyledTextareaWrapper } from '../../Textarea/styled';

Expand Down
3 changes: 1 addition & 2 deletions packages/big-design/src/components/Form/styled.tsx
@@ -1,7 +1,6 @@
import { theme as defaultTheme } from '@bigcommerce/big-design-theme';
import styled from 'styled-components';

import { defaultTheme } from '../../theme';

export const StyledForm = styled.form``;

StyledForm.defaultProps = { theme: defaultTheme };
@@ -1,8 +1,7 @@
import { theme as defaultTheme } from '@bigcommerce/big-design-theme';
import { normalize } from 'polished';
import { createGlobalStyle } from 'styled-components';

import { defaultTheme } from '../../theme';

export const GlobalStyle = createGlobalStyle`
${normalize()}
Expand Down
2 changes: 1 addition & 1 deletion packages/big-design/src/components/Grid/styled.tsx
@@ -1,6 +1,6 @@
import { theme as defaultTheme } from '@bigcommerce/big-design-theme';
import styled from 'styled-components';

import { defaultTheme } from '../../theme';
import { Box } from '../Box';

import { GridProps } from './Grid';
Expand Down
4 changes: 1 addition & 3 deletions packages/big-design/src/components/Icons/Icon.tsx
@@ -1,8 +1,6 @@
import { remCalc, theme as defaultTheme, Spacing, ThemeInterface } from '@bigcommerce/big-design-theme';
import React from 'react';

import { defaultTheme, remCalc, ThemeInterface } from '../../theme';
import { Spacing } from '../../theme/system/spacing';

export interface IconProps extends React.SVGProps<SVGSVGElement> {
size: keyof Spacing | number;
theme?: ThemeInterface;
Expand Down
2 changes: 1 addition & 1 deletion packages/big-design/src/components/Input/Input.tsx
@@ -1,7 +1,7 @@
import { ThemeInterface } from '@bigcommerce/big-design-theme';
import hoistNonReactStatics from 'hoist-non-react-statics';
import React, { Ref } from 'react';

import { ThemeInterface } from '../../theme';
import { uniqueId } from '../../utils';
import { Form } from '../Form';
import { ErrorIcon } from '../Icons';
Expand Down
4 changes: 1 addition & 3 deletions packages/big-design/src/components/Input/styled.tsx
@@ -1,8 +1,6 @@
import { addValues, theme as defaultTheme } from '@bigcommerce/big-design-theme';
import styled, { css } from 'styled-components';

import { defaultTheme } from '../../theme';
import { addValues } from '../../theme/helpers/helpers';

import { InputProps } from './Input';

interface StyledIconWrapperProps {
Expand Down
2 changes: 1 addition & 1 deletion packages/big-design/src/components/Link/styled.tsx
@@ -1,7 +1,7 @@
import { theme as defaultTheme } from '@bigcommerce/big-design-theme';
import styled from 'styled-components';

import { withMargins } from '../../mixins';
import { defaultTheme } from '../../theme';

import { LinkProps } from './Link';

Expand Down
3 changes: 1 addition & 2 deletions packages/big-design/src/components/List/Action/styled.tsx
@@ -1,7 +1,6 @@
import { remCalc, theme as defaultTheme } from '@bigcommerce/big-design-theme';
import styled from 'styled-components';

import { defaultTheme, remCalc } from '../../../theme';

import { ListActionProps } from './Action';

export const StyledListAction = styled.li<ListActionProps>`
Expand Down
2 changes: 1 addition & 1 deletion packages/big-design/src/components/List/Item/Item.tsx
@@ -1,6 +1,6 @@
import { theme as defaultTheme } from '@bigcommerce/big-design-theme';
import React from 'react';

import { defaultTheme } from '../../../theme';
import { CheckIcon } from '../../Icons';

import { StyledListItem } from './styled';
Expand Down
3 changes: 1 addition & 2 deletions packages/big-design/src/components/List/Item/styled.tsx
@@ -1,7 +1,6 @@
import { remCalc, theme as defaultTheme } from '@bigcommerce/big-design-theme';
import styled, { css } from 'styled-components';

import { defaultTheme, remCalc } from '../../../theme';

import { ListItemProps } from './Item';

export const StyledListItem = styled.li<ListItemProps>`
Expand Down
3 changes: 1 addition & 2 deletions packages/big-design/src/components/List/styled.tsx
@@ -1,8 +1,7 @@
import { remCalc, theme as defaultTheme } from '@bigcommerce/big-design-theme';
import { hideVisually } from 'polished';
import styled, { css } from 'styled-components';

import { defaultTheme, remCalc } from './../../theme';

interface StyledList {
isOpen?: boolean;
maxHeight?: number;
Expand Down
2 changes: 1 addition & 1 deletion packages/big-design/src/components/Lozenge/styled.tsx
@@ -1,7 +1,7 @@
import { theme as defaultTheme } from '@bigcommerce/big-design-theme';
import styled, { css } from 'styled-components';

import { withMargins } from '../../mixins';
import { defaultTheme } from '../../theme';

import { LozengeProps } from './Lozenge';

Expand Down
2 changes: 1 addition & 1 deletion packages/big-design/src/components/Modal/styled.tsx
@@ -1,7 +1,7 @@
import { remCalc, theme as defaultTheme } from '@bigcommerce/big-design-theme';
import { rgba } from 'polished';
import styled, { css } from 'styled-components';

import { defaultTheme, remCalc } from '../../theme';
import { Flex } from '../Flex';

import { ModalProps } from './Modal';
Expand Down
2 changes: 1 addition & 1 deletion packages/big-design/src/components/Panel/styled.tsx
@@ -1,6 +1,6 @@
import { theme as defaultTheme } from '@bigcommerce/big-design-theme';
import styled from 'styled-components';

import { defaultTheme } from '../../theme';
import { Box } from '../Box';

import { PanelProps } from './Panel';
Expand Down
3 changes: 1 addition & 2 deletions packages/big-design/src/components/ProgressBar/styled.tsx
@@ -1,7 +1,6 @@
import { theme as defaultTheme } from '@bigcommerce/big-design-theme';
import styled, { css } from 'styled-components';

import { defaultTheme } from '../../theme';

import { ProgressBarProps } from './ProgressBar';

export const StyledProgressBar = styled.div`
Expand Down
@@ -1,6 +1,6 @@
import { remCalc, theme as defaultTheme } from '@bigcommerce/big-design-theme';
import styled, { css, keyframes } from 'styled-components';

import { defaultTheme, remCalc } from '../../theme';
import { ErrorIcon, SuccessIcon } from '../Icons';

import { CIRCLE_CIRCUMFERENCES, CIRCLE_DIMENSIONS, CIRCLE_STROKE_WIDTHS } from './constants';
Expand Down
2 changes: 1 addition & 1 deletion packages/big-design/src/components/Radio/styled.tsx
@@ -1,7 +1,7 @@
import { theme as defaultTheme } from '@bigcommerce/big-design-theme';
import { hideVisually } from 'polished';
import styled, { css, DefaultTheme, StyledComponent } from 'styled-components';

import { defaultTheme } from '../../theme';
import { StyleableText } from '../Typography/private';

interface StyledRadioProps {
Expand Down
2 changes: 1 addition & 1 deletion packages/big-design/src/components/Spinner/Spinner.tsx
@@ -1,6 +1,6 @@
import { ThemeInterface } from '@bigcommerce/big-design-theme';
import React from 'react';

import { ThemeInterface } from '../../theme';
import { IconProps } from '../Icons/Icon';

import { StyledSpinner, StyledSpinnerWrapper } from './styled';
Expand Down
2 changes: 1 addition & 1 deletion packages/big-design/src/components/Spinner/styled.tsx
@@ -1,6 +1,6 @@
import { theme as defaultTheme } from '@bigcommerce/big-design-theme';
import styled, { css } from 'styled-components';

import { defaultTheme } from '../../theme';
import { LoadingIcon } from '../Icons';

import { SpinnerWrapperProps } from './Spinner';
Expand Down
2 changes: 1 addition & 1 deletion packages/big-design/src/components/Tabs/styled.tsx
@@ -1,6 +1,6 @@
import { theme as defaultTheme } from '@bigcommerce/big-design-theme';
import styled, { css } from 'styled-components';

import { defaultTheme } from '../../theme';
import { StyleableButton } from '../Button/private';

import { TabProps } from './Tabs';
Expand Down
2 changes: 1 addition & 1 deletion packages/big-design/src/components/Textarea/Textarea.tsx
@@ -1,7 +1,7 @@
import { ThemeInterface } from '@bigcommerce/big-design-theme';
import hoistNonReactStatics from 'hoist-non-react-statics';
import React, { Ref } from 'react';

import { ThemeInterface } from '../../theme';
import { uniqueId } from '../../utils';
import { Form } from '../Form';
import { Small } from '../Typography';
Expand Down
4 changes: 1 addition & 3 deletions packages/big-design/src/components/Textarea/styled.tsx
@@ -1,8 +1,6 @@
import { addValues, remCalc, theme as defaultTheme } from '@bigcommerce/big-design-theme';
import styled, { css } from 'styled-components';

import { defaultTheme } from '../../theme';
import { addValues, remCalc } from '../../theme/helpers/helpers';

import { TextareaProps } from './Textarea';

export const StyledTextareaWrapper = styled.span<TextareaProps>`
Expand Down
3 changes: 1 addition & 2 deletions packages/big-design/src/components/Tooltip/styled.tsx
@@ -1,7 +1,6 @@
import { remCalc, theme as defaultTheme } from '@bigcommerce/big-design-theme';
import styled from 'styled-components';

import { defaultTheme, remCalc } from '../../theme';

export const StyledTooltipTrigger = styled.div`
display: inline-block;
`;
Expand Down
2 changes: 1 addition & 1 deletion packages/big-design/src/components/Typography/styled.tsx
@@ -1,8 +1,8 @@
import { theme as defaultTheme } from '@bigcommerce/big-design-theme';
import { ellipsis } from 'polished';
import styled, { css } from 'styled-components';

import { withMargins } from '../../mixins';
import { defaultTheme } from '../../theme';

import { HeadingProps, SmallProps, TextProps, TypographyProps } from './Typography';

Expand Down
1 change: 0 additions & 1 deletion packages/big-design/src/index.ts
@@ -1,2 +1 @@
export * from './components';
export * from './theme';
3 changes: 1 addition & 2 deletions packages/big-design/src/mixins/margins/margins.tsx
@@ -1,7 +1,6 @@
import { Breakpoints, Spacing } from '@bigcommerce/big-design-theme';
import { css } from 'styled-components';

import { Breakpoints } from '../../theme/system/breakpoints';
import { Spacing } from '../../theme/system/spacing';
import { getSpacingStyles } from '../spacings';

type SingleMarginProp = keyof Spacing;
Expand Down
3 changes: 1 addition & 2 deletions packages/big-design/src/mixins/margins/spec.tsx
@@ -1,10 +1,9 @@
import { theme as defaultTheme } from '@bigcommerce/big-design-theme';
import { render } from '@testing-library/react';
import 'jest-styled-components';
import React from 'react';
import styled from 'styled-components';

import { defaultTheme } from '../../theme';

import { withMargins, MarginProps } from './margins';

const TestComponent = styled.div<MarginProps>`
Expand Down
3 changes: 1 addition & 2 deletions packages/big-design/src/mixins/paddings/paddings.tsx
@@ -1,7 +1,6 @@
import { Breakpoints, Spacing } from '@bigcommerce/big-design-theme';
import { css } from 'styled-components';

import { Breakpoints } from '../../theme/system/breakpoints';
import { Spacing } from '../../theme/system/spacing';
import { getSpacingStyles } from '../spacings';

type SinglePaddingProp = keyof Spacing;
Expand Down
3 changes: 1 addition & 2 deletions packages/big-design/src/mixins/paddings/spec.tsx
@@ -1,10 +1,9 @@
import { theme as defaultTheme } from '@bigcommerce/big-design-theme';
import { render } from '@testing-library/react';
import 'jest-styled-components';
import React from 'react';
import styled from 'styled-components';

import { defaultTheme } from '../../theme';

import { withPaddings, PaddingProps } from './paddings';

const TestComponent = styled.div<PaddingProps>`
Expand Down
5 changes: 1 addition & 4 deletions packages/big-design/src/mixins/spacings/spacings.ts
@@ -1,9 +1,6 @@
import { breakpointsOrder, Breakpoints, Spacing, ThemeInterface } from '@bigcommerce/big-design-theme';
import { css } from 'styled-components';

import { ThemeInterface } from '../../theme';
import { breakpointsOrder, Breakpoints } from '../../theme/system/breakpoints';
import { Spacing } from '../../theme/system/spacing';

type SingleSpacingProp = keyof Spacing;
type ResponsiveSpacingProp = { [key in keyof Breakpoints]?: keyof Spacing };
type SpacingProp = SingleSpacingProp | ResponsiveSpacingProp;
Expand Down
2 changes: 1 addition & 1 deletion packages/big-design/src/mixins/spacings/spec.ts
@@ -1,4 +1,4 @@
import { defaultTheme } from '../../theme';
import { theme as defaultTheme } from '@bigcommerce/big-design-theme';

import { getSpacingStyles } from './index';

Expand Down

0 comments on commit 4da89f0

Please sign in to comment.