From 36b8f15ba63ddd523199a66b9004cbb5d2962437 Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Sat, 21 Apr 2018 08:32:40 -0700 Subject: [PATCH] clean up icon animations (#203) --- routes/_components/IconButton.html | 22 +++++++++---------- .../profile/AccountProfileFollow.html | 11 ++++------ routes/_components/status/StatusToolbar.html | 18 ++++++++++----- 3 files changed, 27 insertions(+), 24 deletions(-) diff --git a/routes/_components/IconButton.html b/routes/_components/IconButton.html index 8061f870..ded5ba39 100644 --- a/routes/_components/IconButton.html +++ b/routes/_components/IconButton.html @@ -105,17 +105,6 @@ import { store } from '../_store/store' export default { - oncreate () { - this.observe('animation', animation => { - let { reduceMotion } = this.store.get() - if (!animation || reduceMotion) { - return - } - let svg = this.refs.svg - let animations = animation.map(({properties, options}) => svg.animate(properties, options)) - animations.forEach(anim => anim.play()) - }) - }, store: () => store, computed: { computedClass: (pressable, pressed, big, muted, className) => { @@ -128,6 +117,17 @@ className ) } + }, + methods: { + animate (animation) { + let { reduceMotion } = this.store.get() + if (!animation || reduceMotion) { + return + } + let svg = this.refs.svg + let animations = animation.map(({properties, options}) => svg.animate(properties, options)) + animations.forEach(anim => anim.play()) + } } } \ No newline at end of file diff --git a/routes/_components/profile/AccountProfileFollow.html b/routes/_components/profile/AccountProfileFollow.html index d58658d0..ec720b3f 100644 --- a/routes/_components/profile/AccountProfileFollow.html +++ b/routes/_components/profile/AccountProfileFollow.html @@ -6,7 +6,7 @@ pressed="{{following}}" big="true" on:click="onFollowButtonClick(event)" - animation="{{animateFollowButton && followButtonAnimation}}" + ref:icon />