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

[TypeScript] Replace ThemeType Absolute Imports with Relative Imports #510

Merged
merged 2 commits into from
Nov 9, 2020
Merged
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
126 changes: 63 additions & 63 deletions .size-snapshot.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"bundle.js": {
"bundled": 827853,
"minified": 758593,
"gzipped": 91427
"bundled": 823005,
"minified": 753745,
"gzipped": 91062
},
"bundle.umd.js": {
"bundled": 837385,
"minified": 734631,
"gzipped": 87482
"bundled": 832537,
"minified": 729783,
"gzipped": 87250
},
"constants/themes/secondaryTheme.js": {
"bundled": 177,
Expand Down Expand Up @@ -234,9 +234,9 @@
}
},
"shared-components/progressBar/style.js": {
"bundled": 7971,
"minified": 7515,
"gzipped": 2253,
"bundled": 7851,
"minified": 7395,
"gzipped": 2196,
"treeshaked": {
"rollup": {
"code": 1495,
Expand Down Expand Up @@ -472,9 +472,9 @@
}
},
"shared-components/carousel/style.js": {
"bundled": 20523,
"minified": 19882,
"gzipped": 4875,
"bundled": 20339,
"minified": 19698,
"gzipped": 4811,
"treeshaked": {
"rollup": {
"code": 3136,
Expand Down Expand Up @@ -514,9 +514,9 @@
}
},
"shared-components/toggle/style.js": {
"bundled": 7101,
"minified": 6871,
"gzipped": 2513,
"bundled": 6921,
"minified": 6691,
"gzipped": 2463,
"treeshaked": {
"rollup": {
"code": 735,
Expand Down Expand Up @@ -626,9 +626,9 @@
}
},
"shared-components/accordion/style.js": {
"bundled": 36238,
"minified": 35182,
"gzipped": 4829,
"bundled": 36006,
"minified": 34950,
"gzipped": 4790,
"treeshaked": {
"rollup": {
"code": 2701,
Expand All @@ -654,9 +654,9 @@
}
},
"shared-components/field/style.js": {
"bundled": 35325,
"minified": 34582,
"gzipped": 4808,
"bundled": 34905,
"minified": 34162,
"gzipped": 4780,
"treeshaked": {
"rollup": {
"code": 2492,
Expand Down Expand Up @@ -906,9 +906,9 @@
}
},
"shared-components/container/style.js": {
"bundled": 17553,
"minified": 16808,
"gzipped": 2931,
"bundled": 17313,
"minified": 16568,
"gzipped": 2878,
"treeshaked": {
"rollup": {
"code": 1322,
Expand Down Expand Up @@ -948,9 +948,9 @@
}
},
"shared-components/banner/style.js": {
"bundled": 14830,
"minified": 14290,
"gzipped": 3374,
"bundled": 14602,
"minified": 14062,
"gzipped": 3327,
"treeshaked": {
"rollup": {
"code": 1593,
Expand Down Expand Up @@ -1032,9 +1032,9 @@
}
},
"shared-components/alert/style.js": {
"bundled": 35497,
"minified": 34532,
"gzipped": 5262,
"bundled": 35145,
"minified": 34180,
"gzipped": 5189,
"treeshaked": {
"rollup": {
"code": 3041,
Expand Down Expand Up @@ -1074,9 +1074,9 @@
}
},
"shared-components/selectorButton/style.js": {
"bundled": 23956,
"minified": 23222,
"gzipped": 4195,
"bundled": 23656,
"minified": 22922,
"gzipped": 4162,
"treeshaked": {
"rollup": {
"code": 2157,
Expand All @@ -1088,9 +1088,9 @@
}
},
"shared-components/typography/index.js": {
"bundled": 53389,
"minified": 52342,
"gzipped": 3556,
"bundled": 52849,
"minified": 51802,
"gzipped": 3508,
"treeshaked": {
"rollup": {
"code": 2693,
Expand All @@ -1116,9 +1116,9 @@
}
},
"shared-components/loadingSpinner/style.js": {
"bundled": 9621,
"minified": 9240,
"gzipped": 2786,
"bundled": 9585,
"minified": 9204,
"gzipped": 2761,
"treeshaked": {
"rollup": {
"code": 1413,
Expand All @@ -1144,9 +1144,9 @@
}
},
"shared-components/button/style.js": {
"bundled": 35978,
"minified": 34110,
"gzipped": 6768,
"bundled": 35866,
"minified": 33998,
"gzipped": 6763,
"treeshaked": {
"rollup": {
"code": 4650,
Expand All @@ -1172,9 +1172,9 @@
}
},
"shared-components/button/shared-components/loader/style.js": {
"bundled": 6674,
"minified": 5905,
"gzipped": 2574,
"bundled": 6670,
"minified": 5901,
"gzipped": 2570,
"treeshaked": {
"rollup": {
"code": 1710,
Expand All @@ -1186,9 +1186,9 @@
}
},
"shared-components/immersiveModal/style.js": {
"bundled": 103824,
"minified": 102608,
"gzipped": 7728,
"bundled": 103152,
"minified": 101936,
"gzipped": 7724,
"treeshaked": {
"rollup": {
"code": 4482,
Expand Down Expand Up @@ -1284,9 +1284,9 @@
}
},
"shared-components/button/components/linkButton/style.js": {
"bundled": 1753,
"minified": 1504,
"gzipped": 874,
"bundled": 1745,
"minified": 1496,
"gzipped": 860,
"treeshaked": {
"rollup": {
"code": 41,
Expand Down Expand Up @@ -1326,9 +1326,9 @@
}
},
"shared-components/dropdown/style.js": {
"bundled": 44533,
"minified": 43354,
"gzipped": 5931,
"bundled": 44185,
"minified": 43006,
"gzipped": 5906,
"treeshaked": {
"rollup": {
"code": 2644,
Expand All @@ -1340,9 +1340,9 @@
}
},
"shared-components/optionButton/style.js": {
"bundled": 38541,
"minified": 37360,
"gzipped": 4891,
"bundled": 38105,
"minified": 36924,
"gzipped": 4850,
"treeshaked": {
"rollup": {
"code": 2620,
Expand All @@ -1368,9 +1368,9 @@
}
},
"shared-components/chip/style.js": {
"bundled": 7380,
"minified": 6895,
"gzipped": 2630,
"bundled": 7256,
"minified": 6771,
"gzipped": 2590,
"treeshaked": {
"rollup": {
"code": 1300,
Expand Down Expand Up @@ -1410,9 +1410,9 @@
}
},
"shared-components/button/components/roundButton/style.js": {
"bundled": 28975,
"minified": 27269,
"gzipped": 5194,
"bundled": 28663,
"minified": 26957,
"gzipped": 5167,
"treeshaked": {
"rollup": {
"code": 594,
Expand Down
2 changes: 1 addition & 1 deletion src/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ export { default as LAYOUT } from './layout';
export { default as MEDIA_QUERIES } from './mediaQueries';
export { default as PROGRESS_BAR_STATUS } from './progressBarStatus';
export { default as SPACER } from './spacer';
export { primaryTheme, secondaryTheme, COLORS_PROP_TYPES } from './themes';
export * from './themes';
export { default as TYPOGRAPHY_CONSTANTS } from './typography';
export { default as Z_SCALE } from './zScale';
2 changes: 1 addition & 1 deletion src/constants/themes/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export { primaryTheme } from './primaryTheme';
export { secondaryTheme } from './secondaryTheme';
export { COLORS_PROP_TYPES } from './types';
export * from './types';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Rather than have in all our source files:

import { SPACER } from '../../constants';
import { ThemeType } from '../../constants/theme/types';

We can just combine them for convenience:

import { SPACER, ThemeType } from '../../constants';

10 changes: 8 additions & 2 deletions src/shared-components/accordion/style.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import styled from '@emotion/styled';
import { ANIMATION, BREAKPOINTS, BOX_SHADOWS, SPACER } from 'src/constants';
import { ThemeType } from 'src/constants/themes/types';

import {
ANIMATION,
BREAKPOINTS,
BOX_SHADOWS,
SPACER,
ThemeType,
} from '../../constants';

export const Content = styled.div`
padding: ${SPACER.medium};
Expand Down
2 changes: 1 addition & 1 deletion src/shared-components/alert/style.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import styled from '@emotion/styled';
import { keyframes } from '@emotion/core';
import { ThemeType } from 'src/constants/themes/types';

import {
BOX_SHADOWS,
MEDIA_QUERIES,
SPACER,
ANIMATION,
ThemeType,
TYPOGRAPHY_CONSTANTS,
} from '../../constants';

Expand Down
2 changes: 1 addition & 1 deletion src/shared-components/banner/style.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import styled from '@emotion/styled';
import { buttonReset } from 'src/utils/styles/buttonReset';
import { ThemeType } from 'src/constants/themes/types';

import {
BOX_SHADOWS,
MEDIA_QUERIES,
SPACER,
ThemeType,
TYPOGRAPHY_CONSTANTS,
} from '../../constants';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React from 'react';
import PropTypes from 'prop-types';
import { COLORS_PROP_TYPES, ThemeColors } from 'src/constants/themes/types';
import { useTheme } from 'emotion-theming';

import Container from '../../shared-components/container';
import { ButtonType } from '../..';
import { ButtonContents, ButtonText } from '../../style';
import { linkButtonStyles } from './style';
import { COLORS_PROP_TYPES, ThemeColors } from '../../../../constants';

type LinkProps = {
/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { css } from '@emotion/core';
import { ThemeColors, ThemeType } from 'src/constants/themes/types';

import { ButtonType } from '../..';
import { ThemeColors, ThemeType } from '../../../../constants';
import { baseButtonStyles } from '../../style';

export const linkButtonStyles = ({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react';
import PropTypes from 'prop-types';
import { COLORS_PROP_TYPES, ThemeColors } from 'src/constants/themes/types';
import { useTheme } from 'emotion-theming';

import Loader from '../../shared-components/loader';
Expand All @@ -17,6 +16,7 @@ import {
deprecatedProperties,
isLoadingPropFunction,
} from '../../deprecatedPropsHandler';
import { COLORS_PROP_TYPES, ThemeColors } from '../../../../constants';

type RoundButtonProps = {
buttonColor?: ThemeColors;
Expand Down
3 changes: 1 addition & 2 deletions src/shared-components/button/components/roundButton/style.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import styled from '@emotion/styled';
import { css } from '@emotion/core';
import tinycolor from 'tinycolor2';
import { ThemeColors, ThemeType } from 'src/constants/themes/types';

import { ANIMATION } from '../../../../constants';
import { ANIMATION, ThemeColors, ThemeType } from '../../../../constants';
import { ButtonBase } from '../../style';
import { textColorsAssociatedWithColors } from '../../constants';

Expand Down
2 changes: 1 addition & 1 deletion src/shared-components/button/constants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ThemeType } from 'src/constants/themes/types';
import { ThemeType } from '../../constants';

// TODO: potentially break out these pairings to the color constants file
export const textColorsAssociatedWithColors = (theme: ThemeType) =>
Expand Down
2 changes: 1 addition & 1 deletion src/shared-components/button/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react';
import PropTypes from 'prop-types';
import { useTheme } from 'emotion-theming';
import { COLORS_PROP_TYPES, ThemeColors } from 'src/constants/themes/types';

import Loader from './shared-components/loader';
import Container from './shared-components/container';
Expand All @@ -14,6 +13,7 @@ import {
deprecatedProperties,
isLoadingPropFunction,
} from './deprecatedPropsHandler';
import { COLORS_PROP_TYPES, ThemeColors } from '../../constants';

export type ButtonType = 'primary' | 'secondary' | 'tertiary' | 'quaternary';
/**
Expand Down
Loading