Move sidbar into a component
This commit is contained in:
		
							parent
							
								
									762278b437
								
							
						
					
					
						commit
						61e1cdfcf0
					
				
					 4 changed files with 44 additions and 54 deletions
				
			
		
							
								
								
									
										31
									
								
								src/components/Sidebar.vue
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								src/components/Sidebar.vue
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,31 @@ | ||||||
|  | <template> | ||||||
|  |   <div class="w-auto lg:w-64 bg-grey-darkest text-white antialiased"> | ||||||
|  |     <div> | ||||||
|  |       <ul class="list-reset"> | ||||||
|  |         <li v-for="link in links" :key="link.title"> | ||||||
|  |           <a | ||||||
|  |             href="#0" | ||||||
|  |             class="flex items-center no-underline hover:underline focus:underline border-l-6 px-4 py-5" | ||||||
|  |             :class="{ | ||||||
|  |               'border-blue bg-grey-darker': link.active, | ||||||
|  |               'border-transparent': !link.active, | ||||||
|  |               'text-grey cursor-not-allowed': link.disabled, | ||||||
|  |               'text-white': !link.disabled, | ||||||
|  |             }" | ||||||
|  |           > | ||||||
|  |             <svg class="h-6 w-6 fill-current" role="presentation"><use :xlink:href="`/img/icons.symbol.svg#${link.icon}`"></use></svg> | ||||||
|  |             <span class="hidden lg:block lg:ml-4">{{ link.title }}</span> | ||||||
|  |           </a> | ||||||
|  |         </li> | ||||||
|  |       </ul> | ||||||
|  |     </div> | ||||||
|  |   </div> | ||||||
|  | </template> | ||||||
|  | 
 | ||||||
|  | <script> | ||||||
|  | export default { | ||||||
|  |   props: { | ||||||
|  |     links: Array, | ||||||
|  |   }, | ||||||
|  | } | ||||||
|  | </script> | ||||||
|  | @ -4,9 +4,11 @@ import router from './router' | ||||||
| 
 | 
 | ||||||
| Vue.config.productionTip = false | Vue.config.productionTip = false | ||||||
| 
 | 
 | ||||||
|  | import Sidebar from '@/components/Sidebar' | ||||||
| import Navbar from '@/components/Navbar' | import Navbar from '@/components/Navbar' | ||||||
| 
 | 
 | ||||||
| Vue.component('navbar', Navbar); | Vue.component('navbar', Navbar); | ||||||
|  | Vue.component('sidebar', Sidebar); | ||||||
| 
 | 
 | ||||||
| new Vue({ | new Vue({ | ||||||
|   render: h => h(App), |   render: h => h(App), | ||||||
|  |  | ||||||
|  | @ -52,30 +52,11 @@ | ||||||
|         </div> |         </div> | ||||||
|       </div> |       </div> | ||||||
| 
 | 
 | ||||||
|       <div class="w-auto lg:w-64 bg-grey-darkest text-white antialiased"> |       <sidebar :links="[ | ||||||
|         <div> |         { title: 'All', icon: 'alpha__grid', active: true, disabled: false }, | ||||||
|           <ul class="list-reset"> |         { title: 'Starred', icon: 'state__starred', active: false, disabled: false }, | ||||||
|             <li> |         { title: 'Recents', icon: 'objects__recent', active: false, disabled: false }, | ||||||
|               <a href="#0" class="flex items-center text-white no-underline hover:underline focus:underline border-l-6 border-blue px-4 py-5 bg-grey-darker"> |       ]"></sidebar> | ||||||
|                 <svg class="h-6 w-6 text-white fill-current" role="presentation"><use xlink:href="/img/icons.symbol.svg#alpha__grid"></use></svg> |  | ||||||
|                 <span class="hidden lg:block lg:ml-4">All</span> |  | ||||||
|               </a> |  | ||||||
|             </li> |  | ||||||
|             <li> |  | ||||||
|               <a href="#0" class="flex items-center text-white no-underline hover:underline focus:underline border-l-6 border-transparent px-4 py-5"> |  | ||||||
|                 <svg class="h-6 w-6 text-white fill-current" role="presentation"><use xlink:href="/img/icons.symbol.svg#state__starred"></use></svg> |  | ||||||
|                 <span class="hidden lg:block lg:ml-4">Starred</span> |  | ||||||
|               </a> |  | ||||||
|             </li> |  | ||||||
|             <li> |  | ||||||
|               <a href="#0" class="flex items-center text-white no-underline hover:underline focus:underline border-l-6 border-transparent px-4 py-5"> |  | ||||||
|                 <svg class="h-6 w-6 text-white fill-current" role="presentation"><use xlink:href="/img/icons.symbol.svg#objects__recent"></use></svg> |  | ||||||
|                 <span class="hidden lg:block lg:ml-4">Recents</span> |  | ||||||
|               </a> |  | ||||||
|             </li> |  | ||||||
|           </ul> |  | ||||||
|         </div> |  | ||||||
|       </div> |  | ||||||
|     </div> |     </div> | ||||||
|   </div> |   </div> | ||||||
| </template> | </template> | ||||||
|  |  | ||||||
|  | @ -75,36 +75,12 @@ | ||||||
|         <task-log></task-log> |         <task-log></task-log> | ||||||
|       </div> |       </div> | ||||||
| 
 | 
 | ||||||
|       <div class="w-auto lg:w-64 bg-grey-darkest text-white antialiased"> |       <sidebar :links="[ | ||||||
|         <div> |         { title: 'Environments', icon: 'alpha__grid', active: true, disabled: false }, | ||||||
|           <ul class="list-reset"> |         { title: 'Product Keys', icon: 'locations__keys', active: false, disabled: true }, | ||||||
|             <li> |         { title: 'Security', icon: 'alpha__security', active: false, disabled: true }, | ||||||
|               <a href="#0" class="flex items-center text-white no-underline hover:underline focus:underline border-l-6 border-blue px-4 py-5 bg-grey-darker"> |         { title: 'Acquia Search', icon: 'actions__search', active: false, disabled: false }, | ||||||
|                 <svg class="h-6 w-6 text-white fill-current" role="presentation"><use xlink:href="/img/icons.symbol.svg#alpha__grid"></use></svg> |       ]"></sidebar> | ||||||
|                 <span class="hidden lg:block lg:ml-4">Environments</span> |  | ||||||
|               </a> |  | ||||||
|             </li> |  | ||||||
|             <li> |  | ||||||
|               <div class="flex items-center text-grey no-underline hover:underline focus:underline border-l-6 border-transparent px-4 py-5 cursor-not-allowed hover:bg-grey-darker"> |  | ||||||
|                 <svg class="h-6 w-6 text-grey fill-current" role="presentation"><use xlink:href="/img/icons.symbol.svg#locations__keys"></use></svg> |  | ||||||
|                 <span class="hidden lg:block lg:ml-4">Product Keys</span> |  | ||||||
|               </div> |  | ||||||
|             </li> |  | ||||||
|             <li> |  | ||||||
|               <div class="flex items-center text-grey no-underline hover:underline focus:underline border-l-6 border-transparent px-4 py-5 cursor-not-allowed hover:bg-grey-darker"> |  | ||||||
|                 <svg class="h-6 w-6 text-grey fill-current" role="presentation"><use xlink:href="/img/icons.symbol.svg#alpha__security"></use></svg> |  | ||||||
|                 <span class="hidden lg:block lg:ml-4">Security</span> |  | ||||||
|               </div> |  | ||||||
|             </li> |  | ||||||
|             <li> |  | ||||||
|               <a href="#0" class="flex items-center text-white no-underline hover:underline focus:underline border-l-6 border-transparent px-4 py-5 hover:bg-grey-darker"> |  | ||||||
|                 <svg class="h-6 w-6 text-white fill-current" role="presentation"><use xlink:href="/img/icons.symbol.svg#actions__search"></use></svg> |  | ||||||
|                 <span class="hidden lg:block lg:ml-4">Acquia Search</span> |  | ||||||
|               </a> |  | ||||||
|             </li> |  | ||||||
|           </ul> |  | ||||||
|         </div> |  | ||||||
|       </div> |  | ||||||
|     </div> |     </div> | ||||||
|   </div> |   </div> | ||||||
| </template> | </template> | ||||||
|  |  | ||||||
		Reference in a new issue