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

feat(react-ui): turn on 8px theme by default #2344

Merged
merged 6 commits into from
Apr 11, 2021
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
21 changes: 12 additions & 9 deletions packages/react-ui/.creevey/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,56 +12,59 @@ const config = {
chrome: {
browserName: 'chrome',
viewport: { width: 1024, height: 720 },
storybookUrl: 'http://localhost:6061',
platformName: 'linux',
limit: 2,
},
chrome8px: {
browserName: 'chrome',
viewport: { width: 1024, height: 720 },
storybookUrl: 'http://localhost:6061',
storybookUrl: 'http://localhost:6060',
platformName: 'linux',
limit: 2,
},
chromeFlat: {
browserName: 'chrome',
viewport: { width: 1024, height: 720 },
storybookUrl: 'http://localhost:6062',
storybookUrl: 'http://localhost:6063',
platformName: 'linux',
limit: 2,
},
chromeFlat8px: {
browserName: 'chrome',
viewport: { width: 1024, height: 720 },
storybookUrl: 'http://localhost:6063',
storybookUrl: 'http://localhost:6062',
platformName: 'linux',
limit: 2,
},
firefox: {
browserName: 'firefox',
viewport: { width: 1024, height: 720 },
storybookUrl: 'http://localhost:6061',
limit: 2,
},
firefox8px: {
browserName: 'firefox',
viewport: { width: 1024, height: 720 },
storybookUrl: 'http://localhost:6061',
storybookUrl: 'http://localhost:6060',
limit: 2,
},
firefoxFlat: {
browserName: 'firefox',
viewport: { width: 1024, height: 720 },
storybookUrl: 'http://localhost:6062',
storybookUrl: 'http://localhost:6063',
limit: 2,
},
firefoxFlat8px: {
browserName: 'firefox',
viewport: { width: 1024, height: 720 },
storybookUrl: 'http://localhost:6063',
storybookUrl: 'http://localhost:6062',
limit: 2,
},
ie11: {
browserName: 'internet explorer',
viewport: { width: 1024, height: 720 },
storybookUrl: 'http://localhost:6061',
limit: 2,

// NOTE Enable after switch new separate pool for IE to allow test hover
Expand All @@ -77,19 +80,19 @@ const config = {
ie118px: {
browserName: 'internet explorer',
viewport: { width: 1024, height: 720 },
storybookUrl: 'http://localhost:6061',
storybookUrl: 'http://localhost:6060',
limit: 2,
},
ie11Flat: {
browserName: 'internet explorer',
viewport: { width: 1024, height: 720 },
storybookUrl: 'http://localhost:6062',
storybookUrl: 'http://localhost:6063',
limit: 2,
},
ie11Flat8px: {
browserName: 'internet explorer',
viewport: { width: 1024, height: 720 },
storybookUrl: 'http://localhost:6063',
storybookUrl: 'http://localhost:6062',
limit: 2,
},
},
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 6 additions & 6 deletions packages/react-ui/.storybook/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,18 @@ addDecorator(story => (
addDecorator(story => {
const getTheme = () => {
switch (true) {
case Boolean(process.env.STORYBOOK_8PX):
return DEFAULT_THEME_8PX;
case Boolean(process.env.STORYBOOK_FLAT_8PX):
case Boolean(process.env.STORYBOOK_OLD):
return DEFAULT_THEME;
case Boolean(process.env.STORYBOOK_FLAT):
return FLAT_THEME_8PX;
case Boolean(process.env.STORYBOOK_FLAT_UI):
case Boolean(process.env.STORYBOOK_FLAT_OLD):
return FLAT_THEME;
default:
return DEFAULT_THEME;
return DEFAULT_THEME_8PX;
}
};
const theme = getTheme();
if (theme !== DEFAULT_THEME) {
if (theme !== DEFAULT_THEME_8PX) {
return <ThemeContext.Provider value={theme}>{story()}</ThemeContext.Provider>;
}
return story();
Expand Down
6 changes: 3 additions & 3 deletions packages/react-ui/components/Input/__tests__/Input-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import { mount } from 'enzyme';
import MaskedInput from 'react-input-mask';

import { DEFAULT_THEME } from '../../../lib/theming/themes/DefaultTheme';
import { DEFAULT_THEME_8PX } from '../../../lib/theming/themes/DefaultTheme8px';
import { Input, InputProps } from '../Input';
import { jsStyles } from '../Input.styles';

Expand Down Expand Up @@ -46,12 +46,12 @@ describe('<Input />', () => {

it('applies error styles on error prop', () => {
const wrapper = render({ value: '', error: true });
expect(wrapper.find(`.${jsStyles.error(DEFAULT_THEME as any)}`)).toHaveLength(1);
expect(wrapper.find(`.${jsStyles.error(DEFAULT_THEME_8PX as any)}`)).toHaveLength(1);
});

it('applies warning styles on warning prop', () => {
const wrapper = render({ value: '', warning: true });
expect(wrapper.find(`.${jsStyles.warning(DEFAULT_THEME as any)}`)).toHaveLength(1);
expect(wrapper.find(`.${jsStyles.warning(DEFAULT_THEME_8PX as any)}`)).toHaveLength(1);
});

it('applies borderless styles on borderless prop', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/react-ui/components/Tabs/__tests__/Tabs-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('Tabs', () => {
</Tabs>,
);

expect(wrapper.find(Indicator).instance().state).toMatchObject({ styles: { top: -3, left: 0 } });
expect(wrapper.find(Indicator).instance().state).toMatchObject({ styles: { top: -2, left: 0 } });
});
});

Expand Down
16 changes: 8 additions & 8 deletions packages/react-ui/internal/ThemePlayground/Playground.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,19 +130,19 @@ export class Playground extends React.Component<PlaygroundProps, {}> {
case ThemeType.Dark:
return ThemeType.Dark;
case ThemeType.Flat:
case ThemeType.Flat8px:
case ThemeType.FlatOld:
return ThemeType.Flat;
case ThemeType.Default:
case ThemeType.Default8px:
case ThemeType.DefaultOld:
default:
return ThemeType.Default;
}
};

private get is8pxTheme(): boolean {
switch (this.props.currentThemeType) {
case ThemeType.Default8px:
case ThemeType.Flat8px:
case ThemeType.Default:
case ThemeType.Flat:
return true;
default:
return false;
Expand All @@ -153,15 +153,15 @@ export class Playground extends React.Component<PlaygroundProps, {}> {
const { currentThemeType, onThemeChange } = this.props;
switch (currentThemeType) {
case ThemeType.Default:
onThemeChange(ThemeType.Default8px);
onThemeChange(ThemeType.DefaultOld);
break;
case ThemeType.Default8px:
case ThemeType.DefaultOld:
onThemeChange(ThemeType.Default);
break;
case ThemeType.Flat:
onThemeChange(ThemeType.Flat8px);
onThemeChange(ThemeType.FlatOld);
break;
case ThemeType.Flat8px:
case ThemeType.FlatOld:
onThemeChange(ThemeType.Flat);
break;
}
Expand Down
Loading