Skip to content

Commit

Permalink
feat(empty-state): support graphic assigned node
Browse files Browse the repository at this point in the history
Closes #1320
  • Loading branch information
yinonov committed Jun 22, 2022
1 parent e582f2e commit dd9b77b
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 1 deletion.
4 changes: 3 additions & 1 deletion components/empty-state/src/vwc-empty-state-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ export class VWCEmptyStateBase extends LitElement {

protected override render(): TemplateResult {
return html`<section>
${this.icon ? this.renderIcon() : nothing}
<slot name="graphic">
${this.icon ? this.renderIcon() : nothing}
</slot>
${this.heading ? this.renderHeading() : nothing}
${this.body ? this.renderBody() : nothing}
</section>`;
Expand Down
10 changes: 10 additions & 0 deletions components/empty-state/stories/empty-state.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import '@vonage/vwc-empty-state/vwc-empty-state.js';
import { html } from 'lit-element';
import { spread } from '@open-wc/lit-helpers';
import { argTypes } from './arg-types.js';
import { svg } from './svg.js';

export default {
title: 'Alpha/Components/⭐️ Empty State',
Expand All @@ -13,3 +14,12 @@ const Template = args => html`<vwc-empty-state ...=${spread(args)}></vwc-empty-s

export const Basic = Template.bind({});
Basic.args = { icon: 'chat-line', heading: 'Empty State Title', body: 'Empty state body for more information' };

const SlottedTemplate = args => html`<vwc-empty-state ...=${spread(args)}>
<span slot="graphic">
${svg}
</span>
</vwc-empty-state>`;

export const Slotted = SlottedTemplate.bind({});
Slotted.args = { heading: 'Empty State Title', body: 'Empty state body for more information' };
45 changes: 45 additions & 0 deletions components/empty-state/stories/svg.js

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

0 comments on commit dd9b77b

Please sign in to comment.