/* eslint-disable import/extensions */
import hbs from 'htmlbars-inline-precompile';
import { storiesOf } from '@storybook/ember';
import notes from './form-field.md';
import EmberObject from '@ember/object';
const createAttr = (name, type, options) => {
return {
name,
type,
options,
};
};
storiesOf('Form/FormField/', module)
.add(
`FormField|string`,
() => ({
template: hbs`
String Form Field
`,
context: {
attr: createAttr('foo', 'string', { defaultValue: 'default' }),
model: EmberObject.create({}),
},
}),
{ notes }
)
.add(
`FormField|boolean`,
() => ({
template: hbs`
Boolean Form Field
`,
context: {
attr: createAttr('foo', 'boolean', { defaultValue: false }),
model: EmberObject.create({}),
},
}),
{ notes }
)
.add(
`FormField|number`,
() => ({
template: hbs`
Number Form Field
`,
context: {
attr: createAttr('foo', 'number', { defaultValue: 5 }),
model: EmberObject.create({}),
},
}),
{ notes }
)
.add(
`FormField|object`,
() => ({
template: hbs`
Object Form Field
`,
context: {
attr: createAttr('foo', 'object'),
model: EmberObject.create({}),
},
}),
{ notes }
)
.add(
`FormField|textarea`,
() => ({
template: hbs`
Textarea Form Field
`,
context: {
attr: createAttr('foo', 'string', { defaultValue: 'goodbye', editType: 'textarea' }),
model: EmberObject.create({}),
},
}),
{ notes }
)
.add(
`FormField|file`,
() => ({
template: hbs`
File Form Field
`,
context: {
attr: createAttr('foo', 'string', { editType: 'file' }),
model: EmberObject.create({}),
},
}),
{ notes }
)
.add(
`FormField|ttl`,
() => ({
template: hbs`
ttl Form Field
`,
context: {
attr: createAttr('foo', null, { editType: 'ttl' }),
model: EmberObject.create({}),
},
}),
{ notes }
)
.add(
`FormField|stringArray`,
() => ({
template: hbs`
String Array Form Field
`,
context: {
attr: createAttr('foo', 'string', { editType: 'stringArray' }),
model: EmberObject.create({}),
},
}),
{ notes }
)
.add(
`FormField|sensitive`,
() => ({
template: hbs`
Sensitive Form Field
`,
context: {
attr: createAttr('password', 'string', { sensitive: true }),
model: EmberObject.create({}),
},
}),
{ notes }
);