Skip to content

Commit

Permalink
Chromatic story various fixes (#937)
Browse files Browse the repository at this point in the history
Stabilize stories that didn't give us useful results or had errors
  • Loading branch information
snowystinger committed Aug 28, 2020
1 parent a0629e3 commit aa897e9
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 8 deletions.
1 change: 0 additions & 1 deletion .chromatic/config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'storybook-chromatic';
import {configure, addDecorator, addParameters} from '@storybook/react';
import {configureActions} from '@storybook/addon-actions';
import isChromatic from 'storybook-chromatic/isChromatic';
import React from 'react';
import {VerticalCenter} from './layout';
import { withA11y } from '@storybook/addon-a11y';
Expand Down
1 change: 0 additions & 1 deletion .chromatic/custom-addons/chromatic/chromatic.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 8 additions & 2 deletions .chromatic/custom-addons/chromatic/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,18 @@ export const withChromaticProvider = makeDecorator({
} else {
selectedLocales = options.locales ? locales.map(l => l.value).slice(1) : ['en-US', 'ar-AE'];
}
let height = options.height;
let height;
let minHeight;
if(isNaN(options.height)) {
minHeight = 1000;
} else {
height = options.height;
}

// do not add a top level provider, each provider variant needs to be independent so that we don't have RTL/LTR styles that interfere with each other
return (
<DisableAnimations disableAnimations={options.disableAnimations}>
<div style={{display: 'flex', flexDirection: 'column', height}}>
<div style={{display: 'flex', flexDirection: 'column', height, minHeight}}>
{(options.colorSchemes || Object.keys(themes)).map(colorScheme =>
(options.scales || Object.keys(scales)).map(scale =>
(colorScheme === 'light' ? selectedLocales : ['en-US']).map(locale =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ storiesOf('Button/ActionButton', module)
</ActionButton>
<ActionButton isQuiet>
<Add />
Quiet
<Text>Quiet</Text>
</ActionButton>
<ActionButton isDisabled>
<Text>Disabled</Text>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ storiesOf('Dialog', module)
);

storiesOf('Dialog/Alert', module)
.addParameters({chromaticProvider: {colorSchemes: ['light'], locales: ['en-US'], scales: ['medium'], disableAnimations: true}})
.add(
'destructive',
() => renderAlert({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ storiesOf('SearchField', module)
{info}
)
.add('custom width',
() => render({defaultValue: 'React', width: 300})
() => render({defaultValue: 'React', width: 275})
);

function renderSearchLandmark(child) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ storiesOf('TextArea', module)
() => render({label: null, 'aria-label': 'Street address'}, false)
)
.add('custom width',
() => render({icon: <Info />, validationState: 'invalid', width: '300px'})
() => render({icon: <Info />, validationState: 'invalid', width: 275})
);

// allow some stories where disabled styles probably won't affect anything to turn that off, mostly to reduce clutter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ storiesOf('Textfield', module)
() => render({label: null, 'aria-label': 'Street address'}, false)
)
.add('custom width',
() => render({icon: <Info />, validationState: 'invalid', width: '300px'})
() => render({icon: <Info />, validationState: 'invalid', width: 275})
);

// allow some stories where disabled styles probably won't affect anything to turn that off, mostly to reduce clutter
Expand Down

0 comments on commit aa897e9

Please sign in to comment.