From cdf59936986477e1639cfefecc54b248f8024155 Mon Sep 17 00:00:00 2001 From: Michel Bardelmeijer Date: Mon, 21 Aug 2023 14:22:48 +0200 Subject: [PATCH] Add label to services --- config/social-share.php | 9 +++++++++ resources/views/social-share.blade.php | 2 +- src/ConfiguredSocialShareService.php | 3 +++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/config/social-share.php b/config/social-share.php index ccc0afa..2196b04 100644 --- a/config/social-share.php +++ b/config/social-share.php @@ -3,40 +3,49 @@ return [ 'services' => [ 'facebook' => [ + 'label' => 'Facebook', 'url' => 'https://www.facebook.com/sharer/sharer.php?u=#url#&text=#text#', 'color' => '#1777f2', ], // @DEPRECATED. Is replaced with `x`. The values of `x` are the same. 'twitter' => [ 'name' => 'x', + 'label' => 'X', 'url' => 'https://x.com/intent/tweet?url=#url#', 'color' => '#000000', ], 'x' => [ + 'label' => 'X', 'url' => 'https://x.com/intent/tweet?url=#url#', // @TODO: replace with actual URL if `tweet` get's renamed. 'color' => '#000000', ], 'linkedin' => [ + 'label' => 'LinkedIn', 'url' => 'https://www.linkedin.com/sharing/share-offsite/?url=#url#&summary=#text#', 'color' => '#0077b5', ], 'whatsapp' => [ + 'label' => 'WhatsApp', 'url' => 'https://wa.me/?text=#textWithUrl#', 'color' => '#4dc247', ], 'pinterest' => [ + 'label' => 'Pinterest', 'url' => 'https://pinterest.com/pin/create/button/?url=#url#', 'color' => '#cb2027', ], 'reddit' => [ + 'label' => 'Reddit', 'url' => 'https://www.reddit.com/submit?url=#url#&title=#text#', 'color' => '#ff5700', ], 'telegram' => [ + 'label' => 'Telegram', 'url' => 'https://telegram.me/share/url?url=#url#&text=#text#', 'color' => '#0088cc', ], 'email' => [ + 'label' => 'Email', 'url' => 'mailto:?body=#textWithUrl#', 'color' => '#848484', ], diff --git a/resources/views/social-share.blade.php b/resources/views/social-share.blade.php index 6a0a39d..c6c597f 100644 --- a/resources/views/social-share.blade.php +++ b/resources/views/social-share.blade.php @@ -1,6 +1,6 @@
@foreach ($services as $service) - @endforeach diff --git a/src/ConfiguredSocialShareService.php b/src/ConfiguredSocialShareService.php index 045f3a9..3f0dc47 100644 --- a/src/ConfiguredSocialShareService.php +++ b/src/ConfiguredSocialShareService.php @@ -4,6 +4,8 @@ class ConfiguredSocialShareService { + public string $label; + public string $url; public string $color; @@ -15,6 +17,7 @@ public function __construct(public SocialShare $socialShare, public string $name } $this->name = config('social-share.services.'.$this->name.'.name', $name); + $this->label = config('social-share.services.'.$this->name.'.label'); $this->url = config('social-share.services.'.$this->name.'.url'); $this->color = config('social-share.services.'.$this->name.'.color'); }