Skip to content

Commit 06cce84

Browse files
committed
Ajout des articles sur la landing et update des commandes
1 parent d572120 commit 06cce84

File tree

5 files changed

+30
-13
lines changed

5 files changed

+30
-13
lines changed

app/Http/Controllers/HomeController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public function index()
1818
->orderByViews()
1919
->published()
2020
->trending()
21-
->limit(3)
21+
->limit(4)
2222
->get();
2323
});
2424

app/Notifications/PostArticleToTwitter.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public function __construct(public Article $article)
1616
{
1717
}
1818

19-
public function via($notifiable)
19+
public function via($notifiable): array
2020
{
2121
return [TwitterChannel::class];
2222
}
@@ -26,13 +26,13 @@ public function toTwitter($notifiable)
2626
return new TwitterStatusUpdate($this->generateTweet());
2727
}
2828

29-
public function generateTweet()
29+
public function generateTweet(): string
3030
{
3131
$title = $this->article->title;
3232
$url = route('articles.show', $this->article->slug());
3333
$author = $this->article->author;
3434
$author = $author->twitter() ? "@{$author->twitter()}" : $author->name;
3535

36-
return "{$title} by {$author}\n\n{$url}";
36+
return "{$title} par {$author}\n\n{$url}";
3737
}
3838
}

resources/views/articles/show.blade.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,18 +125,21 @@ class="mt-8 prose prose-lg prose-green text-skin-base mx-auto md:prose-xl lg:max
125125
<div class="py-6">
126126
<p class="text-base text-skin-base font-normal">Vous aimez cet article ? Faite le savoir en partageant</p>
127127
<div class="mt-4 flex items-center space-x-3">
128-
<button type="button" data-url="{{ route('articles.show', $article) }}" class="share_twitter inline-flex items-center py-2 px-4 border border-skin-base rounded-md shadow-sm bg-skin-button text-sm leading-5 font-normal text-skin-base hover:bg-skin-button-hover focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-body focus:ring-green-500">
128+
<a href="https://twitter.com/share?text={{ urlencode('"'.$article->title.'" par '. ($article->author->twitter() ? '@'.$article->author->twitter() : $article->author->name) . ' - ') }}&url={{ urlencode(route('articles.show', $article)) }}"
129+
class="inline-flex items-center py-2 px-4 border border-skin-base rounded-md shadow-sm bg-skin-button text-sm leading-5 font-normal text-skin-base hover:bg-skin-button-hover focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-body focus:ring-green-500">
129130
<x-icon.twitter class="h-5 w-5 mr-1.5" />
130131
Twitter
131-
</button>
132-
<button type="button" data-url="{{ route('articles.show', $article) }}" class="share_facebook inline-flex items-center py-2 px-4 border border-skin-base rounded-md shadow-sm bg-skin-button text-sm leading-5 font-normal text-skin-base hover:bg-skin-button-hover focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-body focus:ring-green-500">
132+
</a>
133+
<a href="https://www.facebook.com/sharer/sharer.php?u={{ urlencode(route('articles.show', $article)) }}&quote={{ urlencode('"'.$article->title.'" par '.$article->author->name.' - ') }}"
134+
class="inline-flex items-center py-2 px-4 border border-skin-base rounded-md shadow-sm bg-skin-button text-sm leading-5 font-normal text-skin-base hover:bg-skin-button-hover focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-body focus:ring-green-500">
133135
<x-icon.facebook class="h-5 w-5 mr-1.5" />
134136
Facebook
135-
</button>
136-
<button type="button" data-url="{{ route('articles.show', $article) }}" class="share_linkedin inline-flex items-center py-2 px-4 border border-skin-base rounded-md shadow-sm bg-skin-button text-sm leading-5 font-normal text-skin-base hover:bg-skin-button-hover focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-body focus:ring-green-500">
137+
</a>
138+
<a href="https://www.linkedin.com/shareArticle?mini=true&url={{ urlencode(route('articles.show', $article)) }}&title={{ urlencode('"'.$article->title.'" par '.$article->author->name.' - ') }}"
139+
class="inline-flex items-center py-2 px-4 border border-skin-base rounded-md shadow-sm bg-skin-button text-sm leading-5 font-normal text-skin-base hover:bg-skin-button-hover focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-offset-body focus:ring-green-500">
137140
<x-icon.linkedin class="h-5 w-5 mr-1.5" />
138141
LinkedIn
139-
</button>
142+
</a>
140143
</div>
141144
</div>
142145

resources/views/components/articles/card.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<div class="space-y-6">
44
<a href="{{ route('articles.show', $article) }}" class="group">
5-
<div class="aspect-w-3 aspect-h-2 lg:aspect-w-3 lg:aspect-h-1">
5+
<div class="aspect-w-3 aspect-h-2">
66
<img class="object-cover shadow-lg rounded-lg group-hover:opacity-75" src="{{ $article->getFirstMediaUrl('media') }}" alt="{{ $article->title }}" />
77
</div>
88
</a>

resources/views/home.blade.php

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@
6767

6868
<div class="py-12 lg:py-20">
6969
<x-section-header title="Articles Populaires" content="Découvrez les articles les plus appréciés et partagés par les membres de la communauté" />
70-
<div class="mt-8 grid gap-6 max-w-xl mx-auto lg:grid-rows-2 lg:grid-flow-col lg:grid-cols-2 lg:mt-10 lg:gap-x-8 lg:max-w-none">
70+
<div class="mt-8 grid gap-6 max-w-xl mx-auto lg:grid-rows-3 lg:grid-flow-col lg:grid-cols-2 lg:mt-10 lg:gap-x-8 lg:max-w-none">
7171
@foreach($latestArticles as $article)
7272
@if($loop->first)
73-
<div class="lg:row-span-2">
73+
<div class="lg:row-span-3">
7474
<x-articles.card :article="$article" />
7575
</div>
7676
@else
@@ -80,6 +80,13 @@
8080
@endif
8181
@endforeach
8282
</div>
83+
84+
<div class="flex items-center justify-center mt-10 sm:mt-12 xl:mt-16">
85+
<x-button :link="route('articles')">
86+
Voir tous les articles
87+
<x-heroicon-o-arrow-narrow-right class="h-5 w-5 ml-1.5" />
88+
</x-button>
89+
</div>
8390
</div>
8491

8592
@if($latestThreads->isNotEmpty())
@@ -115,6 +122,13 @@
115122
</div>
116123
@endforeach
117124
</div>
125+
126+
<div class="flex items-center justify-center mt-10 sm:mt-12 xl:mt-16">
127+
<x-button :link="route('forum.index')">
128+
Voir tous les sujets
129+
<x-heroicon-o-arrow-narrow-right class="h-5 w-5 ml-1.5" />
130+
</x-button>
131+
</div>
118132
</div>
119133
@endif
120134
</div>

0 commit comments

Comments
 (0)