Skip to content

Commit

Permalink
refactor(storybook): centralize cxl-app-layout stories
Browse files Browse the repository at this point in the history
  • Loading branch information
lkraav committed Mar 23, 2023
1 parent 4f66ea9 commit e370e9d
Show file tree
Hide file tree
Showing 9 changed files with 478 additions and 500 deletions.
7 changes: 2 additions & 5 deletions packages/storybook/cxl-lumo-styles/body-loading.stories.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
import { withKnobs } from '@storybook/addon-knobs';
import { html } from 'lit';
import cxlLoadingStyles from '@conversionxl/cxl-lumo-styles/src/styles/loading-css';
import { CXLAppLayout } from '../cxl-ui/cxl-app-layout/layout=1c.stories';
import { CXLAppLayout1c } from '../cxl-ui/cxl-app-layout.stories';

export default {
decorators: [withKnobs],
title: 'CXL Lumo Styles/Body',
};

/**
* CXLLoadingSpinner.
*
* @param Loading
* @returns {TemplateResult}
* @constructor
*/
export const CXLLoadingSpinner = ({ Loading }) => {
Expand All @@ -28,7 +25,7 @@ export const CXLLoadingSpinner = ({ Loading }) => {
<style>
${cxlLoadingStyles}
</style>
${CXLAppLayout()}
${CXLAppLayout1c(CXLAppLayout1c.args)}
`;
};

Expand Down
40 changes: 40 additions & 0 deletions packages/storybook/cxl-ui/cxl-app-layout.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { CXLAppLayout1c } from './cxl-app-layout/layout=1c.story';
import { CXLAppLayout1cc } from './cxl-app-layout/layout=1c-c.story';
import { CXLAppLayout1cw } from './cxl-app-layout/layout=1c-w.story';
import { CXLAppLayout2cl } from './cxl-app-layout/layout=2c-l.story';
import { CXLAppLayout2cr } from './cxl-app-layout/layout=2c-r.story';

export default {
title: 'CXL UI/cxl-app-layout',
};

Object.assign(CXLAppLayout1c, {
args: {
backgroundColor: 'var(--lumo-shade-5pct)',
hasWave: true,
},
storyName: '[layout=1c] (default)',
});

CXLAppLayout1cc.storyName = '[layout=1c-c]';
CXLAppLayout1cw.storyName = '[layout=1c-w]';

Object.assign(CXLAppLayout2cl, {
args: {
postId: 1234,
userId: 5678,
playbookSaved: false,
hasWidgetBackground: false,
},
storyName: '[layout=2c-l]',
});

Object.assign(CXLAppLayout2cr, {
args: {
hasPanelsScroll: true,
hasWidgetBackground: false,
},
storyName: '[layout=2c-r]',
});

export { CXLAppLayout1c, CXLAppLayout1cc, CXLAppLayout1cw, CXLAppLayout2cl, CXLAppLayout2cr };
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ import '@conversionxl/cxl-ui/src/components/cxl-marketing-nav.js';
import { CXLMarketingNav } from '../cxl-marketing-nav.stories';
import { CXLFooterNav } from '../footer-nav.stories';

export default {
title: 'CXL UI/cxl-app-layout',
};

export const CXLAppLayout1cc = () => html`
<cxl-app-layout id="container" layout="1c-c">
${CXLMarketingNav()}
Expand Down Expand Up @@ -52,5 +48,3 @@ export const CXLAppLayout1cc = () => html`
${CXLFooterNav()}
</cxl-app-layout>
`;

CXLAppLayout1cc.storyName = '[layout=1c-c]';
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ import { CXLMarketingNav } from '../cxl-marketing-nav.stories';
import { CXLFooterNav } from '../footer-nav.stories';
import { CXLVaadinAccordionThemeArchive } from '../cxl-vaadin-accordion.stories';

export default {
title: 'CXL UI/cxl-app-layout',
};

export const CXLAppLayout1cw = () => html`
<cxl-app-layout id="container" layout="1c-w">
${CXLMarketingNav()}
Expand Down Expand Up @@ -36,5 +32,3 @@ export const CXLAppLayout1cw = () => html`
${CXLFooterNav()}
</cxl-app-layout>
`;

CXLAppLayout1cw.storyName = '[layout=1c-w]';
80 changes: 0 additions & 80 deletions packages/storybook/cxl-ui/cxl-app-layout/layout=1c.stories.js

This file was deleted.

67 changes: 67 additions & 0 deletions packages/storybook/cxl-ui/cxl-app-layout/layout=1c.story.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import { html } from 'lit';
import '@conversionxl/cxl-ui/src/components/cxl-app-layout.js';
import '@conversionxl/cxl-ui/src/components/cxl-marketing-nav.js';
import '@conversionxl/cxl-ui/src/components/cxl-section.js';
import '@vaadin/tooltip';
import { CXLMarketingNav } from '../cxl-marketing-nav.stories';
import { CXLFooterNav } from '../footer-nav.stories';
import { VaadinTooltip } from '../../cxl-lumo-styles/elements.stories';

export const CXLAppLayout1c = ({ backgroundColor, hasWave }) => html`
<style>
.entry-content ul {
font-family: var(--cxl-lumo-font-secondary), serif;
}
</style>
<cxl-app-layout id="container" layout="1c">
${CXLMarketingNav()}
<article class="entry">
<div class="entry-content">
<cxl-section
class="alignwide has-background ${hasWave ? 'has-wave' : ''}"
style="${backgroundColor ? `background-color: ${backgroundColor}` : ''}"
>
${VaadinTooltip(VaadinTooltip.args)}
<h2>
The difference between high-growth and slow-growth companies is the skill sets they have
to make it happen.
</h2>
<p>At CXL, we provide</p>
<ul>
<li>marketing training programs to people serious about their career,</li>
<li>
managed online revenue optimization & experimentation services to help mid-to-large
companies accelerate growth.
</li>
</ul>
<p>
<vaadin-button theme="primary large"
>Marketing training <vaadin-icon icon="lumo:angle-right" slot="suffix"></vaadin-icon
></vaadin-button>
<vaadin-button theme="primary large contrast"
>Managed services <vaadin-icon icon="lumo:angle-right" slot="suffix"></vaadin-icon
></vaadin-button>
</p>
</cxl-section>
<cxl-section>
<h2>Start getting <strong>more</strong> and <strong>bigger wins</strong></h2>
<p>
Getting results you want with conversion optimization and experimentation is all about
knowing what to do. It’s a field where you need to know a lot about a lot, and this
program contains it all.
</p>
<p>After completing it you will</p>
<ul>
<li>improve your skills in conversion optimization, UX, and web analytics,</li>
<li>understand what works on websites, and what doesn't,</li>
<li>develop better A/B tests that win more often.</li>
</ul>
</cxl-section>
</div>
</article>
${CXLFooterNav()}
</cxl-app-layout>
`;
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@ import '@vaadin/button';
import { CXLMarketingNav } from '../cxl-marketing-nav.stories';
import { CXLPlaybookAccordion } from '../cxl-vaadin-accordion.stories';

export default {
title: 'CXL UI/cxl-app-layout',
};

const Template = ({ hasWidgetBackground, postId, userId, playbookSaved }) => html`
export const CXLAppLayout2cl = ({ hasWidgetBackground, postId, userId, playbookSaved }) => html`
<style>
.widget.has-background {
background-color: var(--lumo-shade-5pct);
Expand Down Expand Up @@ -141,14 +137,3 @@ const Template = ({ hasWidgetBackground, postId, userId, playbookSaved }) => htm
</article>
</cxl-app-layout>
`;

export const CXLAppLayout2cl = Template.bind({});

CXLAppLayout2cl.storyName = '[layout=2c-l]';

CXLAppLayout2cl.args = {
postId: 1234,
userId: 5678,
playbookSaved: false,
hasWidgetBackground: false,
};
Loading

0 comments on commit e370e9d

Please sign in to comment.