Display recipe volume where applicable

This commit is contained in:
Christopher C. Wells 2021-04-18 13:55:11 -07:00
parent fb3fa3dd1d
commit e8f2ed8108
2 changed files with 10 additions and 2 deletions

View File

@ -16,7 +16,10 @@
<a x-bind:href="recipe.showUrl"
class="hover:text-gray-600" x-text="recipe.name"></a>
</h1>
<h2 class="leading-snug" x-text="`${recipe.servings} servings`"></h2>
<h2 class="leading-snug">
<span x-text="`${recipe.servings} servings`"></span>
<span x-show="recipe.volume" x-text="` / ${recipe.volumeFormatted} cups`"></span>
</h2>
<section class="flex justify-between items-end font-extrabold" x-show="recipe.serving_weight">
<h1>Serving weight</h1>
<div x-text="`${recipe.serving_weight}g`"></div>

View File

@ -108,7 +108,12 @@
<aside class="flex flex-col space-y-4 mb-8 md:mt-0 sm:max-w-xs">
<div class="p-1 border-2 border-black font-sans md:w-72">
<div class="text-3xl font-extrabold leading-none">Nutrition Facts</div>
<div class="leading-snug">{{ $recipe->servings }} {{ \Illuminate\Support\Str::plural('serving', $recipe->servings ) }}</div>
<div class="leading-snug">
{{ $recipe->servings }} {{ \Illuminate\Support\Str::plural('serving', $recipe->servings ) }}
@if($recipe->volume)
/ {{ $recipe->volume_formatted }} {{ \Illuminate\Support\Str::plural('cup', $recipe->volume ) }}
@endif
</div>
@if($recipe->serving_weight)
<div class="flex justify-between items-end font-extrabold">
<div>Serving weight</div>