| 
									
										
										
										
											2022-08-27 10:44:58 -08:00
										 |  |  | <template> | 
					
						
							| 
									
										
										
										
											2025-09-19 19:38:29 +02:00
										 |  |  |   <div class="ingredient-link-label links-disabled"> | 
					
						
							|  |  |  |     <SafeMarkdown v-if="baseText" :source="baseText" /> | 
					
						
							|  |  |  |     <SafeMarkdown | 
					
						
							|  |  |  |       v-if="ingredient?.note" | 
					
						
							|  |  |  |       class="d-inline" | 
					
						
							|  |  |  |       :source="` ${ingredient.note}`" | 
					
						
							|  |  |  |     /> | 
					
						
							|  |  |  |   </div> | 
					
						
							| 
									
										
										
										
											2022-08-27 10:44:58 -08:00
										 |  |  | </template> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-30 20:37:02 +02:00
										 |  |  | <script setup lang="ts"> | 
					
						
							| 
									
										
										
										
											2025-09-19 19:38:29 +02:00
										 |  |  | import { computed } from "vue"; | 
					
						
							|  |  |  | import type { RecipeIngredient } from "~/lib/api/types/recipe"; | 
					
						
							|  |  |  | import { useParsedIngredientText } from "~/composables/recipes"; | 
					
						
							| 
									
										
										
										
											2025-06-20 00:09:12 +07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-07-30 20:37:02 +02:00
										 |  |  | interface Props { | 
					
						
							| 
									
										
										
										
											2025-09-19 19:38:29 +02:00
										 |  |  |   ingredient?: RecipeIngredient; | 
					
						
							|  |  |  |   scale?: number; | 
					
						
							| 
									
										
										
										
											2025-07-30 20:37:02 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-09-19 19:38:29 +02:00
										 |  |  | const { ingredient, scale = 1 } = defineProps<Props>(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | const baseText = computed(() => { | 
					
						
							|  |  |  |   if (!ingredient) return ""; | 
					
						
							|  |  |  |   const parsed = useParsedIngredientText(ingredient, scale); | 
					
						
							|  |  |  |   return [parsed.quantity, parsed.unit, parsed.name].filter(Boolean).join(" ").trim(); | 
					
						
							|  |  |  | }); | 
					
						
							| 
									
										
										
										
											2022-08-27 10:44:58 -08:00
										 |  |  | </script> | 
					
						
							| 
									
										
										
										
											2025-09-19 19:38:29 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | <style scoped> | 
					
						
							|  |  |  | .ingredient-link-label { | 
					
						
							|  |  |  |   display: block; | 
					
						
							|  |  |  |   line-height: 1.25; | 
					
						
							|  |  |  |   word-break: break-word; | 
					
						
							|  |  |  |   font-size: 0.95rem; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | .links-disabled :deep(a) { | 
					
						
							|  |  |  |   pointer-events: none; | 
					
						
							|  |  |  |   cursor: default; | 
					
						
							|  |  |  |   color: var(--v-theme-primary); | 
					
						
							|  |  |  |   text-decoration: none; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | </style> |