Extract star/unstar button
This commit is contained in:
		
							parent
							
								
									838bb6b136
								
							
						
					
					
						commit
						7e1e2c0bd3
					
				
					 2 changed files with 18 additions and 8 deletions
				
			
		|  | @ -17,10 +17,7 @@ | ||||||
|         </div> |         </div> | ||||||
| 
 | 
 | ||||||
|         <div class="flex-none w-1/6 text-right"> |         <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']"> |           <star-toggle :application="application"></star-toggle> | ||||||
|             <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> |  | ||||||
|         </div> |         </div> | ||||||
|       </div> |       </div> | ||||||
|     </div> |     </div> | ||||||
|  | @ -41,10 +38,7 @@ | ||||||
|           </div> |           </div> | ||||||
| 
 | 
 | ||||||
|           <div class="px-2"> |           <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']"> |             <star-toggle :application="application"></star-toggle> | ||||||
|               <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> |  | ||||||
|           </div> |           </div> | ||||||
|         </div> |         </div> | ||||||
|       </div> |       </div> | ||||||
|  | @ -54,10 +48,12 @@ | ||||||
| 
 | 
 | ||||||
| <script> | <script> | ||||||
| import ApplicationTags from '@/components/Application/ApplicationTags' | import ApplicationTags from '@/components/Application/ApplicationTags' | ||||||
|  | import StarToggle from '@/components/Application/StarToggle' | ||||||
| 
 | 
 | ||||||
| export default { | export default { | ||||||
|   components: { |   components: { | ||||||
|     ApplicationTags, |     ApplicationTags, | ||||||
|  |     StarToggle, | ||||||
|   }, |   }, | ||||||
| 
 | 
 | ||||||
|   props: { |   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