Merge branch 'fix-stars'

This commit is contained in:
Oliver Davies 2019-05-10 08:30:20 +01:00
commit 0c13530233
2 changed files with 7 additions and 9 deletions

View file

@ -17,7 +17,7 @@
</div>
<div class="flex-none w-1/6 text-right">
<star-toggle :application="application"></star-toggle>
<star-toggle :application="application" :starred="starred" @toggle="starred = !starred"></star-toggle>
</div>
</div>
</div>
@ -40,7 +40,7 @@
</div>
<div class="px-2">
<star-toggle :application="application"></star-toggle>
<star-toggle :application="application" :starred="starred" @toggle="starred = !starred"></star-toggle>
</div>
</div>
</div>

View file

@ -1,5 +1,5 @@
<template>
<button type="button" @click="starred = !starred" class="focus:outline-none" :class="[starred ? 'text-orange-100 hover:text-orange-200 focus:text-orange-200' : 'text-gray-400 focus:text-orange-200 hover:text-orange-100']">
<button type="button" @click="$emit('toggle')" class="focus:outline-none" :class="[starred ? 'text-orange-100 hover:text-orange-200 focus:text-orange-200' : 'text-gray-400 focus:text-orange-200 hover:text-orange-100']">
<span class="visuallyhidden">{{ !starred ? 'Star' : 'Unstar' }} {{ application.name }}</span>
<svg class="h-6 w-6 fill-current -mr-1" role="presentation"><use :xlink:href="`/img/icons.symbol.svg#state__${starred ? 'starred' : 'unstarred'}`"></use></svg>
</button>
@ -8,12 +8,10 @@
<script>
export default {
props: {
application: Object
},
data () {
return {
starred: false
application: Object,
starred: {
type: Boolean,
default: false
}
}
}