| 
									
										
										
										
											2024-11-20 08:46:27 -06:00
										 |  |  | <template> | 
					
						
							| 
									
										
										
										
											2025-06-20 00:09:12 +07:00
										 |  |  |   <div | 
					
						
							|  |  |  |     v-if="scaledAmount" | 
					
						
							|  |  |  |     class="d-flex align-center" | 
					
						
							|  |  |  |   > | 
					
						
							|  |  |  |     <v-row | 
					
						
							|  |  |  |       no-gutters | 
					
						
							|  |  |  |       class="d-flex flex-wrap align-center" | 
					
						
							|  |  |  |       style="font-size: larger;" | 
					
						
							|  |  |  |     > | 
					
						
							|  |  |  |       <v-icon | 
					
						
							|  |  |  |         size="x-large" | 
					
						
							|  |  |  |         start | 
					
						
							|  |  |  |         color="primary" | 
					
						
							|  |  |  |       > | 
					
						
							| 
									
										
										
										
											2025-02-26 17:07:12 +01:00
										 |  |  |         {{ $globals.icons.bread }} | 
					
						
							| 
									
										
										
										
											2024-11-20 08:46:27 -06:00
										 |  |  |       </v-icon> | 
					
						
							| 
									
										
										
										
											2025-06-20 00:09:12 +07:00
										 |  |  |       <p class="my-0 opacity-80"> | 
					
						
							|  |  |  |         <span class="font-weight-bold">{{ $t("recipe.yield") }}</span><br> | 
					
						
							| 
									
										
										
										
											2025-02-26 17:07:12 +01:00
										 |  |  |         <!-- eslint-disable-next-line vue/no-v-html --> | 
					
						
							| 
									
										
										
										
											2025-06-20 00:09:12 +07:00
										 |  |  |         <span v-html="scaledAmount" /> {{ text }} | 
					
						
							| 
									
										
										
										
											2025-02-26 17:07:12 +01:00
										 |  |  |       </p> | 
					
						
							|  |  |  |     </v-row> | 
					
						
							| 
									
										
										
										
											2024-11-20 08:46:27 -06:00
										 |  |  |   </div> | 
					
						
							|  |  |  | </template> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <script lang="ts"> | 
					
						
							|  |  |  | import DOMPurify from "dompurify"; | 
					
						
							|  |  |  | import { useScaledAmount } from "~/composables/recipes/use-scaled-amount"; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-20 00:09:12 +07:00
										 |  |  | export default defineNuxtComponent({ | 
					
						
							| 
									
										
										
										
											2024-11-20 08:46:27 -06:00
										 |  |  |   props: { | 
					
						
							|  |  |  |     yieldQuantity: { | 
					
						
							|  |  |  |       type: Number, | 
					
						
							|  |  |  |       default: 0, | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |     yield: { | 
					
						
							|  |  |  |       type: String, | 
					
						
							|  |  |  |       default: "", | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |     scale: { | 
					
						
							|  |  |  |       type: Number, | 
					
						
							|  |  |  |       default: 1, | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |     color: { | 
					
						
							|  |  |  |       type: String, | 
					
						
							| 
									
										
										
										
											2025-06-20 00:09:12 +07:00
										 |  |  |       default: "accent custom-transparent", | 
					
						
							| 
									
										
										
										
											2024-11-20 08:46:27 -06:00
										 |  |  |     }, | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  |   setup(props) { | 
					
						
							|  |  |  |     function sanitizeHTML(rawHtml: string) { | 
					
						
							|  |  |  |       return DOMPurify.sanitize(rawHtml, { | 
					
						
							|  |  |  |         USE_PROFILES: { html: true }, | 
					
						
							|  |  |  |         ALLOWED_TAGS: ["strong", "sup"], | 
					
						
							|  |  |  |       }); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-02-26 17:07:12 +01:00
										 |  |  |     const scaledAmount = computed(() => { | 
					
						
							| 
									
										
										
										
											2025-06-20 00:09:12 +07:00
										 |  |  |       const { scaledAmountDisplay } = useScaledAmount(props.yieldQuantity, props.scale); | 
					
						
							| 
									
										
										
										
											2025-02-26 17:07:12 +01:00
										 |  |  |       return scaledAmountDisplay; | 
					
						
							| 
									
										
										
										
											2024-11-20 08:46:27 -06:00
										 |  |  |     }); | 
					
						
							| 
									
										
										
										
											2025-02-26 17:07:12 +01:00
										 |  |  |     const text = sanitizeHTML(props.yield); | 
					
						
							| 
									
										
										
										
											2024-11-20 08:46:27 -06:00
										 |  |  | 
 | 
					
						
							|  |  |  |     return { | 
					
						
							| 
									
										
										
										
											2025-02-26 17:07:12 +01:00
										 |  |  |       scaledAmount, | 
					
						
							|  |  |  |       text, | 
					
						
							| 
									
										
										
										
											2024-11-20 08:46:27 -06:00
										 |  |  |     }; | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | </script> |