2019-04-03 21:06:20 +00:00
|
|
|
/* eslint-disable import/extensions */
|
|
|
|
import hbs from 'htmlbars-inline-precompile';
|
|
|
|
import { storiesOf } from '@storybook/ember';
|
|
|
|
import { withKnobs, text, boolean } from '@storybook/addon-knobs';
|
|
|
|
import notes from './confirm-action.md';
|
|
|
|
|
|
|
|
storiesOf('ConfirmAction/', module)
|
2019-05-21 00:10:42 +00:00
|
|
|
.addParameters({ options: { showPanel: true } })
|
2019-04-03 21:06:20 +00:00
|
|
|
.addDecorator(
|
|
|
|
withKnobs({
|
|
|
|
escapeHTML: false,
|
|
|
|
})
|
|
|
|
)
|
|
|
|
.add(
|
2019-05-21 00:10:42 +00:00
|
|
|
`ConfirmAction`, () => ({
|
2019-04-03 21:06:20 +00:00
|
|
|
template: hbs`
|
|
|
|
<h5 class="title is-5">Confirm Action</h5>
|
|
|
|
<ConfirmAction
|
2019-05-21 00:10:42 +00:00
|
|
|
@buttonClasses={{buttonClasses}}
|
|
|
|
@confirmTitle={{confirmTitle}}
|
2019-04-03 21:06:20 +00:00
|
|
|
@confirmMessage={{confirmMessage}}
|
2019-05-21 00:10:42 +00:00
|
|
|
@confirmButtonText={{confirmButtonText}}
|
2019-04-03 21:06:20 +00:00
|
|
|
@cancelButtonText={{cancelButtonText}}
|
|
|
|
@disabled={{disabled}}
|
2019-05-21 00:10:42 +00:00
|
|
|
@onConfirmAction={{onComfirmAction}}
|
|
|
|
>
|
|
|
|
{{buttonText}}
|
2019-04-03 21:06:20 +00:00
|
|
|
</ConfirmAction>
|
2019-05-21 00:10:42 +00:00
|
|
|
`,
|
2019-04-03 21:06:20 +00:00
|
|
|
context: {
|
2019-05-21 00:10:42 +00:00
|
|
|
buttonText: text('buttonText', 'Delete'),
|
|
|
|
buttonClasses: text('buttonClasses', 'button'),
|
|
|
|
confirmTitle: text('confirmTitle', 'Delete this?'),
|
|
|
|
confirmMessage: text('confirmMessage', 'You will not be able to recover it later.'),
|
|
|
|
confirmButtonText: text('confirmButtonText', 'Delete'),
|
|
|
|
cancelButtonText: text('cancelButtonText', 'Cancel'),
|
|
|
|
disabled: boolean('disabled', false),
|
2019-04-03 21:06:20 +00:00
|
|
|
onComfirmAction: () => {
|
|
|
|
console.log('Action!');
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
{ notes }
|
|
|
|
);
|