Skip to content

Commit

Permalink
fix(storybook): make clickable optionnal and manage ngContent
Browse files Browse the repository at this point in the history
  • Loading branch information
fgravin committed Feb 14, 2022
1 parent 952a0a3 commit b275f47
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
20 changes: 15 additions & 5 deletions libs/ui/widgets/src/lib/badge/badge.component.stories.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,35 @@
import { Meta, moduleMetadata, Story } from '@storybook/angular'
import {
componentWrapperDecorator,
Meta,
moduleMetadata,
Story,
} from '@storybook/angular'
import { BadgeComponent } from './badge.component'

export default {
title: 'Widgets/BadgeComponent',
component: BadgeComponent,
decorators: [
componentWrapperDecorator(BadgeComponent),
moduleMetadata({
imports: [],
}),
],
} as Meta<BadgeComponent>

type BadgeComponentWithContent = { content: string }

const Template: Story<BadgeComponentWithContent> = (args: BadgeComponent) => ({
interface BadgeComponentContent extends Partial<BadgeComponent> {
content: string
}
const Template: Story<BadgeComponentContent> = (
args: BadgeComponentContent
) => ({
component: BadgeComponent,
props: args,
template: '<gn-ui-badge>{{content}}</gn-ui-badge>',
})

export const Primary = Template.bind({})
Primary.args = {
content: 'My badge!',
clickable: true,
content: 'My custom badge',
}
2 changes: 1 addition & 1 deletion libs/ui/widgets/src/lib/badge/badge.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ import { ChangeDetectionStrategy, Component, Input } from '@angular/core'
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class BadgeComponent {
@Input() clickable = false
@Input() clickable? = false
}

0 comments on commit b275f47

Please sign in to comment.