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(tile): update to storybook v7 #11437

Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix(tile): addressed comments
  • Loading branch information
IgnacioBecerra committed Jan 24, 2024
commit a7c210d8be96da0d7dc41bf4f5e95c7ffaef9cc4
195 changes: 97 additions & 98 deletions packages/carbon-web-components/src/components/tile/tile.stories.ts
kennylam marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -12,6 +12,7 @@ import { ifDefined } from 'lit/directives/if-defined.js';
import { TILE_COLOR_SCHEME } from './tile';
import './index';
import storyDocs from './tile.mdx';
import '../../../.storybook/templates/with-layer';

const colorSchemes = {
[`Regular`]: null,
@@ -107,30 +108,6 @@ const expandableControls = {
}
};



export const Default = {
argTypes: colorSchemeControl,
render: ({ colorScheme }) => html`
<cds-tile color-scheme="${ifDefined(colorScheme)}">
Default tile
<a href="https://example.com">Link</a>
</cds-tile>
`
};

export const DefaultWithLayer = {
argTypes: colorSchemeControl,
render: ({ colorScheme }) => html`
<sb-template-layers>
<cds-tile color-scheme="${ifDefined(colorScheme)}">
Default layer
<a href="https://example.com">Link</a>
</cds-tile>
</sb-template-layers>
`
};

export const clickable = {
args: defaultHref,
argTypes: hrefControl,
@@ -155,88 +132,28 @@ export const ClickableWithLayer = {
`
};

export const Radio = {
args: defaultArgs,
argTypes: radioControls,
render: ({ checkmarkLabel, colorScheme, name, value, onInput }) => html`
<cds-tile-group>
<legend slot="legend">Radio tile group</legend>
<cds-radio-tile
checkmark-label="${ifDefined(checkmarkLabel)}"
color-scheme="${ifDefined(colorScheme)}"
name="${ifDefined(name)}"
value="${ifDefined(value)}"
@input="${onInput}">
Option 1
</cds-radio-tile>
<cds-radio-tile
checkmark-label="${ifDefined(checkmarkLabel)}"
color-scheme="${ifDefined(colorScheme)}"
name="${ifDefined(name)}"
value="${ifDefined(value)}"
@input="${onInput}">
Option 2
</cds-radio-tile>
<cds-radio-tile
checkmark-label="${ifDefined(checkmarkLabel)}"
color-scheme="${ifDefined(colorScheme)}"
name="${ifDefined(name)}"
value="${ifDefined(value)}"
@input="${onInput}">
Option 3
</cds-radio-tile>
</cds-tile-group>
export const Default = {
argTypes: colorSchemeControl,
render: ({ colorScheme }) => html`
<cds-tile color-scheme="${ifDefined(colorScheme)}">
Default tile
<a href="https://example.com">Link</a>
</cds-tile>
`
};

export const RadioWithLayer = {
render: () => html`
export const DefaultWithLayer = {
argTypes: colorSchemeControl,
render: ({ colorScheme }) => html`
<sb-template-layers>
<cds-tile-group>
<legend slot="legend">Radio tile group</legend>
<cds-radio-tile name="option-1a"> Option 1 </cds-radio-tile>
<cds-radio-tile name="option-2a"> Option 2 </cds-radio-tile>
</cds-tile-group>
<cds-tile color-scheme="${ifDefined(colorScheme)}">
Default layer
<a href="https://example.com">Link</a>
</cds-tile>
</sb-template-layers>
`
};

export const MultiSelect = {
args: defaultArgs,
argTypes: multiSelectableControls,
render: ({ checkmarkLabel, colorScheme, name, selected, value, onInput }) => html`
<cds-tile-group>
<cds-selectable-tile
checkmark-label="${ifDefined(checkmarkLabel)}"
color-scheme="${ifDefined(colorScheme)}"
name="${ifDefined(name)}"
?selected="${selected}"
value="${ifDefined(value)}"
@input="${onInput}">
Option 1
</cds-selectable-tile>
<cds-selectable-tile
checkmark-label="${ifDefined(checkmarkLabel)}"
color-scheme="${ifDefined(colorScheme)}"
name="${ifDefined(name)}"
?selected="${selected}"
value="${ifDefined(value)}"
@input="${onInput}">
Option 2
</cds-selectable-tile>
<cds-selectable-tile
checkmark-label="${ifDefined(checkmarkLabel)}"
color-scheme="${ifDefined(colorScheme)}"
name="${ifDefined(name)}"
?selected="${selected}"
value="${ifDefined(value)}"
@input="${onInput}">
Option 3
</cds-selectable-tile>
</cds-tile-group>
`
};

export const expandable = {
args: expandableArgs,
argTypes: expandableControls,
@@ -329,6 +246,88 @@ export const ExpandableWithLayer = {
`;
}};

export const Radio = {
kennylam marked this conversation as resolved.
Show resolved Hide resolved
args: defaultArgs,
argTypes: radioControls,
render: ({ checkmarkLabel, colorScheme, name, value, onInput }) => html`
<cds-tile-group>
<legend slot="legend">Radio tile group</legend>
<cds-radio-tile
checkmark-label="${ifDefined(checkmarkLabel)}"
color-scheme="${ifDefined(colorScheme)}"
name="${ifDefined(name)}"
value="${ifDefined(value)}"
@input="${onInput}">
Option 1
</cds-radio-tile>
<cds-radio-tile
checkmark-label="${ifDefined(checkmarkLabel)}"
color-scheme="${ifDefined(colorScheme)}"
name="${ifDefined(name)}"
value="${ifDefined(value)}"
@input="${onInput}">
Option 2
</cds-radio-tile>
<cds-radio-tile
checkmark-label="${ifDefined(checkmarkLabel)}"
color-scheme="${ifDefined(colorScheme)}"
name="${ifDefined(name)}"
value="${ifDefined(value)}"
@input="${onInput}">
Option 3
</cds-radio-tile>
</cds-tile-group>
`
};

export const RadioWithLayer = {
render: () => html`
<sb-template-layers>
<cds-tile-group>
<legend slot="legend">Radio tile group</legend>
<cds-radio-tile name="option-1a"> Option 1 </cds-radio-tile>
<cds-radio-tile name="option-2a"> Option 2 </cds-radio-tile>
</cds-tile-group>
</sb-template-layers>
`
};

export const MultiSelect = {
args: defaultArgs,
argTypes: multiSelectableControls,
render: ({ checkmarkLabel, colorScheme, name, selected, value, onInput }) => html`
<cds-tile-group>
<cds-selectable-tile
checkmark-label="${ifDefined(checkmarkLabel)}"
color-scheme="${ifDefined(colorScheme)}"
name="${ifDefined(name)}"
?selected="${selected}"
value="${ifDefined(value)}"
@input="${onInput}">
Option 1
</cds-selectable-tile>
<cds-selectable-tile
checkmark-label="${ifDefined(checkmarkLabel)}"
color-scheme="${ifDefined(colorScheme)}"
name="${ifDefined(name)}"
?selected="${selected}"
value="${ifDefined(value)}"
@input="${onInput}">
Option 2
</cds-selectable-tile>
<cds-selectable-tile
checkmark-label="${ifDefined(checkmarkLabel)}"
color-scheme="${ifDefined(colorScheme)}"
name="${ifDefined(name)}"
?selected="${selected}"
value="${ifDefined(value)}"
@input="${onInput}">
Option 3
</cds-selectable-tile>
</cds-tile-group>
`
};

export const Selectable = {
render: () => html` <cds-selectable-tile> Default tile </cds-selectable-tile> `
};
Loading