From e6bd8cbe3f4a79b8325b5c75b7d52b33d2429322 Mon Sep 17 00:00:00 2001 From: Kevin Ansfield Date: Tue, 25 Apr 2017 16:03:28 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A5=20remove=20unused=20gh-spin-button?= =?UTF-8?q?=20component?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit closes https://github.com/TryGhost/Ghost/issues/7865 - `gh-spin-button` has been replaced with `gh-task-button` --- ghost/admin/app/components/gh-spin-button.js | 64 ------------------- ghost/admin/app/styles/patterns/buttons.css | 48 -------------- .../templates/components/gh-spin-button.hbs | 9 --- .../unit/components/gh-spin-button-test.js | 23 ------- 4 files changed, 144 deletions(-) delete mode 100644 ghost/admin/app/components/gh-spin-button.js delete mode 100644 ghost/admin/app/templates/components/gh-spin-button.hbs delete mode 100644 ghost/admin/tests/unit/components/gh-spin-button-test.js diff --git a/ghost/admin/app/components/gh-spin-button.js b/ghost/admin/app/components/gh-spin-button.js deleted file mode 100644 index 8a23becbb7..0000000000 --- a/ghost/admin/app/components/gh-spin-button.js +++ /dev/null @@ -1,64 +0,0 @@ -import Component from 'ember-component'; -import Ember from 'ember'; -import {equal} from 'ember-computed'; -import observer from 'ember-metal/observer'; -import run from 'ember-runloop'; - -// ember-cli-shims doesn't export Ember.Testing -const {testing} = Ember; - -export default Component.extend({ - tagName: 'button', - buttonText: '', - submitting: false, - showSpinner: false, - showSpinnerTimeout: null, - autoWidth: true, - - // Disable Button when isLoading equals true - attributeBindings: ['disabled', 'type', 'tabindex'], - - // Must be set on the controller - disabled: equal('showSpinner', true), - - click() { - if (this.get('action')) { - this.sendAction('action'); - return false; - } - return true; - }, - - toggleSpinner: observer('submitting', function () { - let submitting = this.get('submitting'); - let timeout = this.get('showSpinnerTimeout'); - let delay = testing ? 10 : 1000; - - if (submitting) { - this.set('showSpinner', true); - this.set('showSpinnerTimeout', run.later(this, function () { - if (!this.get('submitting')) { - this.set('showSpinner', false); - } - this.set('showSpinnerTimeout', null); - }, delay)); - } else if (!submitting && timeout === null) { - this.set('showSpinner', false); - } - }), - - setSize: observer('showSpinner', function () { - if (this.get('showSpinner') && this.get('autoWidth')) { - this.$().width(this.$().width()); - this.$().height(this.$().height()); - } else { - this.$().width(''); - this.$().height(''); - } - }), - - willDestroy() { - this._super(...arguments); - run.cancel(this.get('showSpinnerTimeout')); - } -}); diff --git a/ghost/admin/app/styles/patterns/buttons.css b/ghost/admin/app/styles/patterns/buttons.css index 2eb56d304e..90e56b0f98 100644 --- a/ghost/admin/app/styles/patterns/buttons.css +++ b/ghost/admin/app/styles/patterns/buttons.css @@ -317,54 +317,6 @@ svg.gh-btn-icon-right { } -/* -/* Loading Button Spinner -/* ---------------------------------------------------------- */ -/* - -Usage: Swap out button>span text with HTML - - - -
-
- - -*/ - -.gh-spinner { - position: relative; - display: inline-block; - width: 18px; - height: 18px; - border: rgba(0,0,0,0.2) solid 4px; - border-radius: 100%; - animation: spin 1s linear infinite; -} - -.gh-spinner:before { - content: ""; - display: block; - margin-top: 9px; - width: 4px; - height: 4px; - background: rgba(0,0,0,0.6); - border-radius: 100%; -} - -@keyframes spin { - 0% { - transform: rotate(0deg); - } - 50% { - transform: rotate(180deg); - } - 100% { - transform: rotate(360deg); - } -} - - /* /* Button Variations /* ---------------------------------------------------------- */ diff --git a/ghost/admin/app/templates/components/gh-spin-button.hbs b/ghost/admin/app/templates/components/gh-spin-button.hbs deleted file mode 100644 index 211c4a2659..0000000000 --- a/ghost/admin/app/templates/components/gh-spin-button.hbs +++ /dev/null @@ -1,9 +0,0 @@ -{{#if showSpinner}} - {{inline-svg "spinner"}} -{{else}} - {{#if buttonText}} - {{buttonText}} - {{else}} - {{{yield}}} - {{/if}} -{{/if}} diff --git a/ghost/admin/tests/unit/components/gh-spin-button-test.js b/ghost/admin/tests/unit/components/gh-spin-button-test.js deleted file mode 100644 index e51ef91f75..0000000000 --- a/ghost/admin/tests/unit/components/gh-spin-button-test.js +++ /dev/null @@ -1,23 +0,0 @@ -/* jshint expr:true */ -import {expect} from 'chai'; -import {describe, it} from 'mocha'; -import {setupComponentTest} from 'ember-mocha'; - -describe('Unit: Component: gh-spin-button', function () { - setupComponentTest('gh-spin-button', { - unit: true - // specify the other units that are required for this test - // needs: ['component:foo', 'helper:bar'] - }); - - it('renders', function () { - // creates the component instance - let component = this.subject(); - - expect(component._state).to.equal('preRender'); - - // renders the component on the page - this.render(); - expect(component._state).to.equal('inDOM'); - }); -});