mirror of https://github.com/kcal-app/kcal.git
				
				
				
			Adjust recipe show page styles
This commit is contained in:
		
							parent
							
								
									7b0abbc5af
								
							
						
					
					
						commit
						04631d2106
					
				|  | @ -18,27 +18,27 @@ | ||||||
|             </a> |             </a> | ||||||
|         </h1> |         </h1> | ||||||
|     </x-slot> |     </x-slot> | ||||||
|     <div class="flex flex-col-reverse justify-between pb-4 sm:flex-row"> |     <div class="flex flex-col justify-between pb-4 md:flex-row md:space-x-4"> | ||||||
|         <div x-data="{showNutrientsSummary: false}"> |         <div x-data="{showNutrientsSummary: false}"> | ||||||
|             @if($recipe->description) |             @if($recipe->time_total > 0) | ||||||
|                 <section class="mb-2 prose prose-lg md:prose-xl"> |                 <section class="flex justify-between mb-2 p-2 bg-gray-100 rounded"> | ||||||
|                     {!! $recipe->description !!} |                     <div> | ||||||
|  |                         <h1 class="mb-1 font-bold">Prep time</h1> | ||||||
|  |                         <p class="text-gray-800 text-sm">{{ $recipe->time_prep }} minutes</p> | ||||||
|  |                     </div> | ||||||
|  |                     <div> | ||||||
|  |                         <h1 class="mb-1 font-bold">Active time</h1> | ||||||
|  |                         <p class="text-gray-800 text-sm">{{ $recipe->time_active }} minutes</p> | ||||||
|  |                     </div> | ||||||
|  |                     <div> | ||||||
|  |                         <h1 class="mb-1 font-bold">Total time</h1> | ||||||
|  |                         <p class="text-gray-800 text-sm">{{ $recipe->time_total }} minutes</p> | ||||||
|  |                     </div> | ||||||
|                 </section> |                 </section> | ||||||
|             @endif |             @endif | ||||||
|             @if($recipe->time_total > 0) |             @if($recipe->description) | ||||||
|                 <section class="flex space-x-4"> |                 <section class="mb-2 prose prose-lg"> | ||||||
|                     <div> |                     {!! $recipe->description !!} | ||||||
|                         <h1 class="mb-2 font-bold text-lg">Prep time</h1> |  | ||||||
|                         <p class="mb-2 text-gray-800">{{ $recipe->time_prep }} minutes</p> |  | ||||||
|                     </div> |  | ||||||
|                     <div> |  | ||||||
|                         <h1 class="mb-2 font-bold text-lg">Active time</h1> |  | ||||||
|                         <p class="mb-2 text-gray-800">{{ $recipe->time_active }} minutes</p> |  | ||||||
|                     </div> |  | ||||||
|                     <div> |  | ||||||
|                         <h1 class="mb-2 font-bold text-lg">Total time</h1> |  | ||||||
|                         <p class="mb-2 text-gray-800">{{ $recipe->time_total }} minutes</p> |  | ||||||
|                     </div> |  | ||||||
|                 </section> |                 </section> | ||||||
|             @endif |             @endif | ||||||
|             <section x-data="{showNutrientsSummary: false}"> |             <section x-data="{showNutrientsSummary: false}"> | ||||||
|  | @ -47,28 +47,42 @@ | ||||||
|                     <span class="text-sm text-gray-500 hover:text-gray-700 hover:border-gray-300 font-normal cursor-pointer" |                     <span class="text-sm text-gray-500 hover:text-gray-700 hover:border-gray-300 font-normal cursor-pointer" | ||||||
|                           x-on:click="showNutrientsSummary = !showNutrientsSummary">[toggle nutrients]</span> |                           x-on:click="showNutrientsSummary = !showNutrientsSummary">[toggle nutrients]</span> | ||||||
|                 </h1> |                 </h1> | ||||||
|                 <ul class="space-y-2"> |                 <div class="prose prose-lg"> | ||||||
|                     @foreach($recipe->ingredientAmounts as $ia) |                     <ul class="space-y-2"> | ||||||
|                         <li> |                         @foreach($recipe->ingredientAmounts as $ia) | ||||||
|                             {{ \App\Support\Number::fractionStringFromFloat($ia->amount) }} |                             <li> | ||||||
|                             @if($ia->unitFormatted){{ $ia->unitFormatted }}@endif |                                 <span> | ||||||
|                             @if($ia->ingredient->type === \App\Models\Recipe::class) |                                     {{ \App\Support\Number::fractionStringFromFloat($ia->amount) }} | ||||||
|                                 <a class="text-gray-500 hover:text-gray-700 hover:border-gray-300" |                                     @if($ia->unitFormatted){{ $ia->unitFormatted }}@endif | ||||||
|                                    href="{{ route('recipes.show', $ia->ingredient) }}"> |                                     @if($ia->ingredient->type === \App\Models\Recipe::class) | ||||||
|                                     {{ $ia->ingredient->name }} |                                         <a class="text-gray-500 hover:text-gray-700 hover:border-gray-300" | ||||||
|                                 </a> |                                            href="{{ route('recipes.show', $ia->ingredient) }}"> | ||||||
|                             @else |                                             {{ $ia->ingredient->name }} | ||||||
|                                 {{ $ia->ingredient->name }}@if($ia->ingredient->detail), {{ $ia->ingredient->detail }}@endif |                                         </a> | ||||||
|                             @endif |                                     @else | ||||||
|                             @if($ia->detail)<span class="text-gray-500">{{ $ia->detail }}</span>@endif |                                         {{ $ia->ingredient->name }}@if($ia->ingredient->detail), {{ $ia->ingredient->detail }}@endif | ||||||
|                             <div x-show="showNutrientsSummary" class="text-sm text-gray-500">{{ $ia->nutrients_summary }}</div> |                                     @endif | ||||||
|                         </li> |                                     @if($ia->detail)<span class="text-gray-500">{{ $ia->detail }}</span>@endif | ||||||
|                     @endforeach |                                     <div x-show="showNutrientsSummary" class="text-sm text-gray-500">{{ $ia->nutrients_summary }}</div> | ||||||
|                 </ul> |                                 </span> | ||||||
|  |                             </li> | ||||||
|  |                         @endforeach | ||||||
|  |                     </ul> | ||||||
|  |                 </div> | ||||||
|  |             </section> | ||||||
|  |             <section> | ||||||
|  |                 <h1 class="mb-2 font-bold text-2xl">Steps</h1> | ||||||
|  |                 <div class="prose prose-lg"> | ||||||
|  |                     <ol> | ||||||
|  |                         @foreach($recipe->steps as $step) | ||||||
|  |                             <li>{{ $step->step }}</li> | ||||||
|  |                         @endforeach | ||||||
|  |                     </ol> | ||||||
|  |                 </div> | ||||||
|             </section> |             </section> | ||||||
|         </div> |         </div> | ||||||
|         <aside> |         <aside class="flex flex-col space-y-4 md:w-1/2 lg:w-1/3"> | ||||||
|             <div class="p-1 border-2 border-black font-sans sm:ml-4 md:w-72"> |             <div class="p-1 border-2 border-black font-sans w-72"> | ||||||
|                 <div class="text-3xl font-extrabold leading-none">Nutrition Facts</div> |                 <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 ) }}</div> | ||||||
|                 @if($recipe->serving_weight) |                 @if($recipe->serving_weight) | ||||||
|  | @ -110,32 +124,27 @@ | ||||||
|                     </div> |                     </div> | ||||||
|                 </div> |                 </div> | ||||||
|             </div> |             </div> | ||||||
|  |             @if($recipe->source) | ||||||
|  |                 <section> | ||||||
|  |                     <h1 class="mb-2 font-bold text-2xl">Source</h1> | ||||||
|  |                     @if(filter_var($recipe->source, FILTER_VALIDATE_URL)) | ||||||
|  |                         <a class="text-gray-500 hover:text-gray-700 hover:border-gray-300" | ||||||
|  |                            href="{{ $recipe->source }}">{{ $recipe->source }}</a> | ||||||
|  |                     @else | ||||||
|  |                         {{ $recipe->source }} | ||||||
|  |                     @endif | ||||||
|  |                 </section> | ||||||
|  |             @endif | ||||||
|  |             @if(!$recipe->tags->isEmpty()) | ||||||
|  |                 <section> | ||||||
|  |                     <h1 class="mb-2 font-bold text-2xl">Tags</h1> | ||||||
|  |                     <div class="flex flex-wrap"> | ||||||
|  |                         @foreach($recipe->tags as $tag) | ||||||
|  |                             <span class="m-1 bg-gray-200 rounded-full px-2 leading-loose cursor-default">{{ $tag->name }}</span> | ||||||
|  |                         @endforeach | ||||||
|  |                     </div> | ||||||
|  |                 </section> | ||||||
|  |             @endif | ||||||
|         </aside> |         </aside> | ||||||
|     </div> |     </div> | ||||||
|     <section> |  | ||||||
|         <h1 class="mb-2 font-bold text-2xl">Steps</h1> |  | ||||||
|         <div class="prose prose-xl md:prose-2xl"> |  | ||||||
|             <ol> |  | ||||||
|                 @foreach($recipe->steps as $step) |  | ||||||
|                     <li>{{ $step->step }}</li> |  | ||||||
|                 @endforeach |  | ||||||
|             </ol> |  | ||||||
|         </div> |  | ||||||
|     </section> |  | ||||||
|     @if($recipe->source) |  | ||||||
|         <footer class="mb-2 text-gray-500 text-sm"> |  | ||||||
|             <h1 class="font-extrabold inline">Source:</h1> |  | ||||||
|             @if(filter_var($recipe->source, FILTER_VALIDATE_URL)) |  | ||||||
|                 <a href="{{ $recipe->source }}">{{ $recipe->source }}</a> |  | ||||||
|             @else |  | ||||||
|                 {{ $recipe->source }} |  | ||||||
|             @endif |  | ||||||
|         </footer> |  | ||||||
|     @endif |  | ||||||
|     @if(!$recipe->tags->isEmpty()) |  | ||||||
|         <section class="mb-2 text-gray-500 text-sm"> |  | ||||||
|             <h1 class="font-extrabold inline">Tags:</h1> |  | ||||||
|             {{ implode(', ', $recipe->tags->pluck('name')->all()) }} |  | ||||||
|         </section> |  | ||||||
|     @endif |  | ||||||
| </x-app-layout> | </x-app-layout> | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue