|
| 1 | +<div class="container mx-auto px-4 pt-4 flex flex-wrap flex-col-reverse md:flex-row"> |
| 2 | + <div class="w-full lg:w-1/4 lg:pt-8 pr-4"> |
| 3 | + <span class="relative z-0 inline-flex shadow-sm mb-8"> |
| 4 | + <button wire:click="sortBy('recent')" type="button" class="relative inline-flex items-center px-4 py-2 rounded-l-md border text-sm leading-5 font-medium focus:z-10 focus:outline-none focus:border-green-light focus:shadow-outline-green active:bg-green-primary active:text-white transition ease-in-out duration-150 {{ $selectedSortBy === 'recent' ? 'bg-green-primary text-white border-green-primary shadow-outline-green z-10' : 'bg-white text-gray-700 border-gray-300' }}"> |
| 5 | + Recent |
| 6 | + </button> |
| 7 | + <button wire:click="sortBy('popular')" type="button" class="-ml-px relative inline-flex items-center px-4 py-2 border text-sm leading-5 font-medium focus:z-10 focus:outline-none focus:border-green-light focus:shadow-outline-green active:bg-green-primary active:text-white transition ease-in-out duration-150 {{ $selectedSortBy === 'popular' ? 'bg-green-primary text-white border-green-primary shadow-outline-green z-10' : 'bg-white text-gray-700 border-gray-300' }}"> |
| 8 | + Popular |
| 9 | + </button> |
| 10 | + <button wire:click="sortBy('trending')" type="button" class="-ml-px relative inline-flex items-center px-4 py-2 rounded-r-md border text-sm leading-5 font-medium focus:z-10 focus:outline-none focus:border-green-light focus:shadow-outline-green active:bg-green-primary active:text-white transition ease-in-out duration-150 {{ $selectedSortBy === 'trending' ? 'bg-green-primary text-white border-green-primary shadow-outline-green z-10' : 'bg-white text-gray-700 border-gray-300' }}"> |
| 11 | + Trending 🔥 |
| 12 | + </button> |
| 13 | + </span> |
| 14 | + |
| 15 | + <ul class="tags"> |
| 16 | + <li class="{{ ! $selectedTag ? ' active' : '' }}"> |
| 17 | + <button wire:click="toggleTag('')"> |
| 18 | + All |
| 19 | + </button> |
| 20 | + </li> |
| 21 | + |
| 22 | + @foreach (App\Models\Tag::whereHas('articles')->orderBy('name')->get() as $tag) |
| 23 | + <li class="{{ $selectedTag === $tag->slug() ? ' active' : '' }}"> |
| 24 | + <button wire:click="toggleTag('{{ $tag->slug() }}')"> |
| 25 | + {{ $tag->name() }} |
| 26 | + </button> |
| 27 | + </li> |
| 28 | + @endforeach |
| 29 | + </ul> |
| 30 | + </div> |
| 31 | + <div class="w-full lg:w-3/4 py-8 pl-4"> |
| 32 | + <div wire:loading class="flex w-full h-full text-2xl text-gray-700"> |
| 33 | + Loading... |
| 34 | + </div> |
| 35 | + |
| 36 | + @foreach($articles as $article) |
| 37 | + <div class="pb-8 mb-8 border-b-2"> |
| 38 | + <div> |
| 39 | + @foreach($article->tags() as $tag) |
| 40 | + <button class="inline-block focus:outline-none rounded-full {{ $tag->slug() === $selectedTag ? 'bg-green-primary text-white shadow-outline-green' : 'bg-green-light text-green-primary' }}" wire:click="toggleTag('{{ $tag->slug() }}')"> |
| 41 | + <span class="inline-flex items-center px-3 py-0.5 rounded-full text-sm font-medium leading-5"> |
| 42 | + {{ $tag->name() }} |
| 43 | + </span> |
| 44 | + </button> |
| 45 | + @endforeach |
| 46 | + </div> |
| 47 | + <a href="{{ route('articles.show', $article->slug()) }}" class="block"> |
| 48 | + <h3 class="mt-4 text-xl leading-7 font-semibold text-gray-900"> |
| 49 | + {{ $article->title() }} |
| 50 | + </h3> |
| 51 | + <p class="mt-3 text-base leading-6 text-gray-500"> |
| 52 | + {{ $article->excerpt() }} |
| 53 | + </p> |
| 54 | + </a> |
| 55 | + |
| 56 | + <div class="flex items-center justify-between mt-6"> |
| 57 | + <div class="flex items-center"> |
| 58 | + <div class="flex-shrink-0"> |
| 59 | + <a href="#"> |
| 60 | + <img class="h-10 w-10 rounded-full" src="{{ $article->author()->gravatarUrl($avatarSize ?? 250) }}" alt="{{ $article->author()->name }}" /> |
| 61 | + </a> |
| 62 | + </div> |
| 63 | + <div class="ml-3"> |
| 64 | + <p class="text-sm leading-5 font-medium text-gray-900"> |
| 65 | + <a href="#"> |
| 66 | + {{ $article->author()->name() }} |
| 67 | + </a> |
| 68 | + </p> |
| 69 | + <div class="flex text-sm leading-5 text-gray-500"> |
| 70 | + <time datetime="{{ $article->publishedAt()->format('Y-m-d') }}"> |
| 71 | + {{ $article->publishedAt()->format('j M, Y') }} |
| 72 | + </time> |
| 73 | + <span class="mx-1"> |
| 74 | + · |
| 75 | + </span> |
| 76 | + <span> |
| 77 | + {{ $article->readTime() }} min read |
| 78 | + </span> |
| 79 | + </div> |
| 80 | + </div> |
| 81 | + </div> |
| 82 | + <div class="flex items-center text-gray-500"> |
| 83 | + <svg fill="currentColor" viewBox="0 0 20 20" class="w-5 h-5 mr-2"> |
| 84 | + <path d="M3.172 5.172a4 4 0 015.656 0L10 6.343l1.172-1.171a4 4 0 115.656 5.656L10 17.657l-6.828-6.829a4 4 0 010-5.656z" clip-rule="evenodd" fill-rule="evenodd"></path> |
| 85 | + </svg> |
| 86 | + {{ $article->likesCount() }} |
| 87 | + </div> |
| 88 | + </div> |
| 89 | + </div> |
| 90 | + @endforeach |
| 91 | + |
| 92 | + {{ $articles->links() }} |
| 93 | + |
| 94 | + </div> |
| 95 | +</div> |
0 commit comments