diff --git a/code/examples/official-storybook/manager.js b/code/examples/official-storybook/manager.js index 642d6e7bfb23..77104c4f6326 100644 --- a/code/examples/official-storybook/manager.js +++ b/code/examples/official-storybook/manager.js @@ -8,10 +8,11 @@ import addHeadWarning from './head-warning'; addHeadWarning('manager-head-not-loaded', 'Manager head not loaded'); const PrefixIcon = styled(Icons)(({ theme }) => ({ - marginRight: 8, + marginRight: 5, fontSize: 'inherit', - height: '1em', - width: '1em', + height: 12, + width: 12, + paddingTop: 1, display: 'inline', alignSelf: 'center', })); diff --git a/code/examples/official-storybook/preview.js b/code/examples/official-storybook/preview.js index 638d31b1af82..e4e0ef7fa7d9 100644 --- a/code/examples/official-storybook/preview.js +++ b/code/examples/official-storybook/preview.js @@ -72,6 +72,25 @@ const ThemeStack = styled.div( }) ); +const PlayFnNotice = styled.div( + { + position: 'absolute', + bottom: '1rem', + right: '1rem', + border: '1px solid #ccc', + borderRadius: '5px', + padding: '1rem', + fontSize: '12px', + '> *': { + display: 'block', + }, + }, + ({ theme }) => ({ + background: theme.background.app, + color: theme.color.defaultText, + }) +); + const ThemedSetRoot = () => { const theme = useTheme(); @@ -87,8 +106,9 @@ const ThemedSetRoot = () => { }; export const decorators = [ - (StoryFn, { globals, parameters }) => { - const theme = globals.theme || parameters.theme || (isChromatic() ? 'stacked' : 'light'); + (StoryFn, { globals, parameters, playFunction }) => { + const defaultTheme = isChromatic() && !playFunction ? 'stacked' : 'light'; + const theme = globals.theme || parameters.theme || defaultTheme; switch (theme) { case 'side-by-side': { @@ -137,6 +157,12 @@ export const decorators = [ + {!parameters.theme && isChromatic() && playFunction && ( + + Detected play function. + Rendering in a single theme + + )} ); diff --git a/code/lib/builder-manager/templates/template.ejs b/code/lib/builder-manager/templates/template.ejs index 046d109199ee..1eaad092f2a9 100644 --- a/code/lib/builder-manager/templates/template.ejs +++ b/code/lib/builder-manager/templates/template.ejs @@ -2,13 +2,14 @@ + <%= typeof title !== 'undefined'? title : 'Storybook'%> <% if (typeof head !== 'undefined') { %> <%- head %> <% } %> - +