Skip to content

Commit

Permalink
🎨 first pass at animated icons for save-state buttons
Browse files Browse the repository at this point in the history
refs TryGhost/Ghost#7515
- adds animated spinner and check SVG icons
- improves SVG sizing/alignment in buttons
- disables old technique of fixing button size because it doesn't work now that buttons have more than a single spinner when running/saved/failed
  • Loading branch information
kevinansfield committed Apr 11, 2017
1 parent 34cb65d commit 732cbe9
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 9 deletions.
8 changes: 4 additions & 4 deletions app/components/gh-task-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,11 @@ const GhTaskButton = Component.extend({
setSize: observer('isRunning', function () {
if (this.get('isRunning')) {
this.set('hasRun', true);
this.$().width(this.$().width());
this.$().height(this.$().height());
// this.$().width(this.$().width());
// this.$().height(this.$().height());
} else {
this.$().width('');
this.$().height('');
// this.$().width('');
// this.$().height('');
}
})
});
Expand Down
28 changes: 25 additions & 3 deletions app/styles/patterns/buttons.css
Original file line number Diff line number Diff line change
Expand Up @@ -292,23 +292,45 @@ fieldset[disabled] .gh-btn {
display: flex;
align-items: center;
justify-content: center;

}

.gh-btn-icon svg {
margin-right: 10px;
height: 13px;
width: 1em;
height: 1em;
margin-right: 0.5em;
fill: #fff;
}

.gh-btn-icon-right svg {
margin-left: 10px;
margin-left: 0.5em;
margin-right: 0;
}

.gh-btn-icon svg path {
stroke: #fff;
}

/*
/* Animated button icons
/* ---------------------------------------------------------- */

path.animated-check-circle {
stroke: white;
stroke-dashoffset: 300;
stroke-dasharray: 300;
animation: dash 4s ease-out forwards;
}

@keyframes dash {
0% {
stroke-dashoffset: 300;
}
100% {
stroke-dashoffset: 0;
}
}


/*
/* Loading Button Spinner
Expand Down
16 changes: 16 additions & 0 deletions app/styles/patterns/icons.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
path.animated-check-circle {
stroke: white;
stroke-dashoffset: 300;
stroke-dasharray: 300;
animation: dash 4s ease-out forwards;
}

@keyframes dash {
0% {
stroke-dashoffset: 300;
}
100% {
stroke-dashoffset: 0;
}
}

/* Icons
/* ---------------------------------------------------------- */
/* CUSTOM GENERATED FILE */
Expand Down
2 changes: 1 addition & 1 deletion app/templates/components/gh-task-button.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
)}}
{{else}}
<span>
{{#if isRunning}}<span class="spinner"></span>{{/if}}
{{#if isRunning}}{{inline-svg "spinner"}}{{/if}}
{{if (or isIdle isRunning) buttonText}}
{{#if isSuccess}}{{inline-svg "check-circle"}} {{successText}}{{/if}}
{{#if isFailure}}{{inline-svg "close"}} {{failureText}}{{/if}}
Expand Down
6 changes: 5 additions & 1 deletion public/assets/icons/check-circle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions public/assets/icons/spinner.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 732cbe9

Please sign in to comment.