Sha256: afa2a16f5dd77eec16a2e6a26d9b32a87e21d784e2801ee9d220ebe01721f315

Contents?: true

Size: 743 Bytes

Versions: 1

Compression:

Stored size: 743 Bytes

Contents

import Component from '@ember/component';
import { computed } from '@ember/object';
import { bool } from '@ember/object/computed';
import layout from '../templates/components/bsy-button';

export default Component.extend({
  layout,

  tagName: 'button',
  classNames: 'btn',
  classNameBindings: ['typeClassName', 'loadingClassName'],
  attributeBindings: ['disabled'],
  isLoading: false,
  loadingLabel: 'Loading...',

  disabled: bool('isLoading'),

  typeClassName: computed('type', function() {
    return this.type === 'submit' ? 'btn-primary' : `btn-${this.type}`;
  }),

  loadingClassName: computed('isLoading', function() {
    return this.isLoading ? 'btn-loading' : '';
  }),

  click() {
    this.set('isLoading', true);
  }
});

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bootstrap-bookingsync-sass-2.0.0 addon/components/bsy-button.js