refactor: 💡 convert form to nested structure
This commit is contained in:
4 files changed
+21
-27
No files matched your search
@@ -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;
|
||||
},
|
||||
});
|
||||
File renamed without changes.
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
File renamed without changes.
Reference in new issue
Block a user