docs(web-components): set attributes in example story

This commit is contained in:
Benny Powers 2021-07-08 19:34:58 +03:00
parent e2d34eac36
commit 2c47a6e29a
2 changed files with 5 additions and 4 deletions

View File

@ -1,5 +1,6 @@
import { Meta, Story } from '@storybook/web-components';
import { html } from 'lit';
import { ifDefined } from 'lit/directives/if-defined.js';
import { SbButton } from './sb-button';
@ -20,9 +21,9 @@ export default {
const Template: Story<SbButton> = ({ primary, backgroundColor, size, label }) =>
html`<sb-button
?primary="${primary}"
.size="${size}"
.label="${label}"
.backgroundColor="${backgroundColor}"
size="${ifDefined(size)}"
label="${ifDefined(label)}"
background-color="${ifDefined(backgroundColor)}"
></sb-button>`;
export const Primary: Story<SbButton> = Template.bind({});

View File

@ -61,7 +61,7 @@ export class SbButton extends LitElement {
label: { type: String, reflect: true },
primary: { type: Boolean },
size: { type: String },
backgroundColor: { type: String },
backgroundColor: { type: String, attribute: 'background-color' },
};
}