refactor: 💡 convert form to nested structure

This commit is contained in:
Randall Morey committed 2020-09-23 12:20:15 -04:00
1 parent 0169700b33
commit fbe04de148
4 files changed
+21 -27

No files matched your search

-27
View File
@@ -1,27 +0,0 @@
import Component from '@ember/component';
import layout from '../../templates/components/rose/form';
import { action } from '@ember/object';
/**
* A component for building accessible forms. Yields contextual fields
* and actions.
*/
export default Component.extend({
layout,
tagName: '',
// =actions
/**
* Calls the passed `onSubmit` function and disabled the default form
* submit behavior.
* @param {Event} e
*/
@action
handleSubmit(e) {
e.preventDefault();
e.stopPropagation();
this.onSubmit();
return false;
},
});
@@ -0,0 +1,21 @@
import Component from '@glimmer/component';
import { action } from '@ember/object';
export default class RoseFormComponent extends Component {
// =actions
/**
* Calls the passed `onSubmit` function while disabling the default form
* submit behavior.
* @param {Event} e
*/
@action
handleSubmit(e) {
e.preventDefault();
e.stopPropagation();
this.args.onSubmit();
return false;
}
}