Extract star/unstar button
This commit is contained in:
parent
838bb6b136
commit
7e1e2c0bd3
|
@ -17,10 +17,7 @@
|
|||
</div>
|
||||
|
||||
<div class="flex-none w-1/6 text-right">
|
||||
<button type="button" @click="starred = !starred" class="focus:outline-none" :class="[starred ? 'text-orange hover:text-orange-light focus:text-orange-light' : 'text-grey focus:text-orange hover:text-orange']">
|
||||
<span class="visuallyhidden">{{ !starred ? 'Star' : 'Unstar' }} {{ application.name }}</span>
|
||||
<svg class="h-6 w-6 fill-current" role="presentation"><use :xlink:href="`/img/icons.symbol.svg#state__${starred ? 'starred' : 'unstarred'}`"></use></svg>
|
||||
</button>
|
||||
<star-toggle :application="application"></star-toggle>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -41,10 +38,7 @@
|
|||
</div>
|
||||
|
||||
<div class="px-2">
|
||||
<button type="button" @click="starred = !starred" class="focus:outline-none" :class="[starred ? 'text-orange hover:text-orange-light focus:text-orange-light' : 'text-grey focus:text-orange hover:text-orange']">
|
||||
<span class="visuallyhidden">{{ !starred ? 'Star' : 'Unstar' }} {{ application.name }}</span>
|
||||
<svg class="h-6 w-6 fill-current" role="presentation"><use :xlink:href="`/img/icons.symbol.svg#state__${starred ? 'starred' : 'unstarred'}`"></use></svg>
|
||||
</button>
|
||||
<star-toggle :application="application"></star-toggle>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -54,10 +48,12 @@
|
|||
|
||||
<script>
|
||||
import ApplicationTags from '@/components/Application/ApplicationTags'
|
||||
import StarToggle from '@/components/Application/StarToggle'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
ApplicationTags,
|
||||
StarToggle,
|
||||
},
|
||||
|
||||
props: {
|
||||
|
|
14
src/components/Application/StarToggle.vue
Normal file
14
src/components/Application/StarToggle.vue
Normal file
|
@ -0,0 +1,14 @@
|
|||
<template>
|
||||
<button type="button" @click="starred = !starred" class="focus:outline-none" :class="[starred ? 'text-orange hover:text-orange-light focus:text-orange-light' : 'text-grey focus:text-orange hover:text-orange']">
|
||||
<span class="visuallyhidden">{{ !starred ? 'Star' : 'Unstar' }} {{ application.name }}</span>
|
||||
<svg class="h-6 w-6 fill-current" role="presentation"><use :xlink:href="`/img/icons.symbol.svg#state__${starred ? 'starred' : 'unstarred'}`"></use></svg>
|
||||
</button>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
application: Object,
|
||||
},
|
||||
}
|
||||
</script>
|
Reference in a new issue