Skip to content

Commit

Permalink
Deprecate Twitter service, automatically replace with X.com
Browse files Browse the repository at this point in the history
  • Loading branch information
mbardelmeijer committed Aug 14, 2023
1 parent 4345e34 commit 8b7f817
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,20 @@ The advantage of including it is that it will be automatically updated if change
You can use the Facade in your templates as follows:

```blade
{{ SocialShare::facebook()->twitter()->linkedin()->whatsapp()->render() }}
{{ SocialShare::facebook()->x()->linkedin()->whatsapp()->render() }}
```

You can chain multiple services next to each other. The following services are currently supported. Pull requests are welcome to expand this.

- Facebook
- Twitter
- X _(previously Twitter)_
- LinkedIn
- WhatsApp
- Pinterest
- Reddit
- Telegram
- Email
- Twitter _(deprecated)_ - automatically replaced with `x`

You can increase the size or set styling options as follows:

Expand All @@ -68,7 +69,7 @@ You may want to pass along text to the different sharing options. This text will
You can combine all options:

```blade
{{ SocialShare::facebook()->twitter()->reddit()->square()->large()->text('Lorem ipsum!')->render() }}
{{ SocialShare::facebook()->x()->reddit()->square()->large()->text('Lorem ipsum!')->render() }}
```

## Config
Expand Down
10 changes: 8 additions & 2 deletions config/social-share.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,15 @@
'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' => [
'url' => 'https://twitter.com/intent/tweet?url=#url#',
'color' => '#1da1f2',
'name' => 'x',
'url' => 'https://x.com/intent/tweet?url=#url#',
'color' => '#000000',
],
'x' => [
'url' => 'https://x.com/intent/tweet?url=#url#', // @TODO: replace with actual URL if `tweet` get's renamed.
'color' => '#000000',
],
'linkedin' => [
'url' => 'https://www.linkedin.com/sharing/share-offsite/?url=#url#&summary=#text#',
Expand Down
1 change: 1 addition & 0 deletions resources/icons/x.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/ConfiguredSocialShareService.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public function __construct(public SocialShare $socialShare, public string $name
throw Exceptions\UnknownService::create($name);
}

$this->name = config('social-share.services.'.$this->name.'.name', $name);
$this->url = config('social-share.services.'.$this->name.'.url');
$this->color = config('social-share.services.'.$this->name.'.color');
}
Expand Down

0 comments on commit 8b7f817

Please sign in to comment.