add option to reduce motion

This commit is contained in:
Nolan Lawson 2018-03-22 20:23:00 -07:00
parent 76848d4c35
commit 2785eb28c3
3 changed files with 10 additions and 2 deletions

View File

@ -63,13 +63,13 @@
} }
</style> </style>
<script> <script>
import { classname } from '../_utils/classname' import { classname } from '../_utils/classname'
import { store } from '../_store/store'
export default { export default {
oncreate() { oncreate() {
this.observe('animation', animation => { this.observe('animation', animation => {
if (!animation) { if (!animation || this.store.get('reduceMotion')) {
return return
} }
let svg = this.refs.svg let svg = this.refs.svg
@ -77,6 +77,7 @@
animations.forEach(anim => anim.play()) animations.forEach(anim => anim.play())
}) })
}, },
store: () => store,
computed: { computed: {
computedClass: (pressable, pressed, big, className) => { computedClass: (pressable, pressed, big, className) => {
return classname( return classname(

View File

@ -13,6 +13,11 @@
bind:checked="$markMediaAsSensitive" on:change="store.save()"> bind:checked="$markMediaAsSensitive" on:change="store.save()">
<label for="choice-mark-media-sensitive">Always mark media as sensitive</label> <label for="choice-mark-media-sensitive">Always mark media as sensitive</label>
</div> </div>
<div class="setting-group">
<input type="checkbox" id="choice-reduce-motion"
bind:checked="$reduceMotion" on:change="store.save()">
<label for="choice-reduce-motion">Reduce motion in UI animations</label>
</div>
</form> </form>
</SettingsLayout> </SettingsLayout>

View File

@ -13,6 +13,7 @@ const KEYS_TO_STORE_IN_LOCAL_STORAGE = new Set([
'loggedInInstancesInOrder', 'loggedInInstancesInOrder',
'autoplayGifs', 'autoplayGifs',
'markMediaAsSensitive', 'markMediaAsSensitive',
'reduceMotion',
'pinnedPages', 'pinnedPages',
'composeData' 'composeData'
]) ])
@ -34,6 +35,7 @@ export const store = new PinaforeStore({
sensitivesShown: {}, sensitivesShown: {},
autoplayGifs: false, autoplayGifs: false,
markMediaAsSensitive: false, markMediaAsSensitive: false,
reduceMotion: false,
pinnedPages: {}, pinnedPages: {},
instanceLists: {}, instanceLists: {},
pinnedStatuses: {}, pinnedStatuses: {},