addon/components/ui-pointing-label.js

  1. import Component from '@ember/component';
  2. import { computed } from '@ember/object';
  3. import layout from '../templates/components/ui-pointing-label';
  4. import uiLabelBase from '../mixins/ui-label-base';
  5.  
  6.  
  7. /**
  8.  
  9. ui-pointing-label component see {{#crossLink "mixins.uiLabelBase"}}{{/crossLink}}
  10.  
  11.  
  12. @module components
  13. @namespace components
  14. @class UiPointingLabel
  15. @constructor
  16. */
  17. export default Component.extend(uiLabelBase, {
  18. layout: layout,
  19. /**
  20. * pointing direction: below, left, right
  21. *
  22. * @property {String} direction
  23. */
  24. direction: '',
  25. _theme: computed('direction', function() {
  26. let direction = ['pointing'];
  27. if(this.direction === 'below'){
  28. direction.push(this.direction);
  29. }
  30.  
  31. if(this.direction === 'left' || this.direction === 'right'){
  32. direction.push(this.direction);
  33. direction = direction.reverse();
  34. }
  35.  
  36. return direction.join(' ');
  37. })
  38. });