| 
									
										
										
										
											2020-04-02 14:20:33 +02:00
										 |  |  | <template> | 
					
						
							|  |  |  |   <div class="page-toc mt-4"> | 
					
						
							|  |  |  |     <p class="subtitle-2 pl-6 pr-6">Table des matières</p> | 
					
						
							|  |  |  |     <ul> | 
					
						
							|  |  |  |       <li :class="[ itemPadding(h), 'mb-1' ]" v-for="h in headers"> | 
					
						
							|  |  |  |         <a :href="anchor(h)">{{ h.title }}</a> | 
					
						
							|  |  |  |       </li> | 
					
						
							|  |  |  |     </ul> | 
					
						
							|  |  |  |   </div> | 
					
						
							|  |  |  | </template> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <script> | 
					
						
							|  |  |  | export default { | 
					
						
							|  |  |  |   name: 'PageToc', | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   data () { | 
					
						
							|  |  |  |     return { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   computed: { | 
					
						
							|  |  |  |     headers () { | 
					
						
							|  |  |  |       return this.$page.headers | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   methods: { | 
					
						
							|  |  |  |     anchor (h) { | 
					
						
							|  |  |  |       return '#' + h.slug | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |     itemPadding (h) { | 
					
						
							|  |  |  |       return 'pl-' + (h.level - 2) * 4 | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   mounted () { | 
					
						
							| 
									
										
										
										
											2020-04-16 18:08:21 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-04-02 14:20:33 +02:00
										 |  |  |   } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | </script> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <style lang="scss"> | 
					
						
							|  |  |  | @import '../styles/colors'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .page-toc { | 
					
						
							| 
									
										
										
										
											2021-02-09 17:49:44 +01:00
										 |  |  |   font-size: .9rem; | 
					
						
							| 
									
										
										
										
											2020-04-02 14:20:33 +02:00
										 |  |  |   ul { | 
					
						
							|  |  |  |     list-style: none; | 
					
						
							|  |  |  |     padding-right: 24px; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     li { | 
					
						
							|  |  |  |       a { | 
					
						
							|  |  |  |         color: $color-gray; | 
					
						
							|  |  |  |         text-decoration: none; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         &:hover { | 
					
						
							|  |  |  |           color: $color-dragon; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2020-04-16 18:08:21 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | .theme--dark { | 
					
						
							|  |  |  |   .page-toc { | 
					
						
							|  |  |  |     ul { | 
					
						
							|  |  |  |       li { | 
					
						
							|  |  |  |         a { | 
					
						
							|  |  |  |           color: lighten($color-gray, 20); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           &:hover { | 
					
						
							|  |  |  |             color: lighten($color-dragon, 15); | 
					
						
							|  |  |  |           } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2020-04-02 14:20:33 +02:00
										 |  |  | </style> |