datahub/wherehows-web/app/components/auto-suggest-action.js

29 lines
687 B
JavaScript

import Ember from 'ember';
const { Component, computed, getProperties } = Ember;
export default Component.extend({
tagName: 'button',
classNames: ['compliance-auto-suggester-action'],
classNameBindings: ['isAffirmative:compliance-auto-suggester-action--accept'],
/**
* Determines the type of suggestion action this is
* if type property is passed in
*/
isAffirmative: computed.equal('type', 'accept'),
/**
* Action handler for click event, invokes closure action with type as argument
*/
click() {
const { intent, action } = getProperties(this, 'type', 'action');
if (typeof action === 'function') {
return action(intent);
}
}
});