Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/plenty-pears-sniff.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@solid-primitives/share": minor
---

Added Bluesky and X networks
14 changes: 8 additions & 6 deletions packages/share/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ pnpm add @solid-primitives/share
### How to use it

```ts
import { createSocialShare, TWITTER } from "@solid-primitives/share";
import { createSocialShare, BLUESKY } from "@solid-primitives/share";

const [share, close] = createSocialShare(() => ({
title: "SolidJS.com",
url: "https://www.solidjs.com",
description: "Simple and well-behaved reactivity!",
}));
share(TWITTER);
share(BLUESKY);
```

### Definition
Expand Down Expand Up @@ -67,6 +67,7 @@ The following are a list of supported networks that may be imported from the sha
| ------------- | ------------------ | ------------------ | ------------------ | ----------------------------------------------------------------------------------------------------------- |
| Baidu | :heavy_check_mark: | :heavy_check_mark: | :x: | |
| Buffer | :heavy_check_mark: | :heavy_check_mark: | :x: | |
| Bluesky | :heavy_check_mark: | :heavy_check_mark: | :x: | |
| Email | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | |
| EverNote | :heavy_check_mark: | :heavy_check_mark: | :x: | |
| Facebook | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | `hashtags` A list of comma-separated hashtags, only the first one will be used.<br/>`quote` Facebook quote. |
Expand All @@ -86,6 +87,7 @@ The following are a list of supported networks that may be imported from the sha
| Telegram | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | |
| Tumblr | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | |
| Twitter | :heavy_check_mark: | :heavy_check_mark: | :x: | `hashtags` A list of comma-separated hashtags.<br/>`twitter-user` Twitter user to mention. |
| X | :heavy_check_mark: | :heavy_check_mark: | :x: | `hashtags` A list of comma-separated hashtags.<br/>`twitter-user` X user to mention. |
| Viber | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | |
| VK | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | `media` URL of an image describing the content. |
| Weibo | :heavy_check_mark: | :heavy_check_mark: | :x: | `media` URL of an image describing the content. |
Expand All @@ -94,7 +96,7 @@ The following are a list of supported networks that may be imported from the sha
| Xing | :heavy_check_mark: | :heavy_check_mark: | :x: | |
| Yammer | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | |

For the networks: `Line`, `Skype`, `SMS`, `Telegram`, `Viber`, `WhatsApp` and `Yammer`; the shared content is a string of the form: "`$title` `$url` `$description`"
For the networks: `Bluesky`, `Line`, `Skype`, `SMS`, `Telegram`, `Viber`, `WhatsApp` and `Yammer`; the shared content is a string of the form: "`$title` `$url` `$description`"

Note that you can also provide your own custom network by formatting the input string into the share function. The following is a list of properties that will be replaced by the utility:

Expand All @@ -104,12 +106,12 @@ Note that you can also provide your own custom network by formatting the input s
- `@q`: Quote
- `@h`: Hashtags
- `@m`: Media
- `@tu`: TwitterUser (Twitter specific)
- `@tu`: X User (X specific)

The following is an example of Twitter's share string:
The following is an example of X's share string:

```ts
const twitter: Network = "https://twitter.com/intent/tweet?text=@t&url=@u&hashtags=@h@tu";
const x: Network = "https://www.x.com/intent/tweet?text=@t&url=@u&hashtags=@h@tu";
```

### Demo
Expand Down
2 changes: 2 additions & 0 deletions packages/share/src/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const BAIDU: Network = "http://cang.baidu.com/do/add?iu=@u&it=@t";
export const BUFFER: Network = "https://bufferapp.com/add?text=@t&url=@u";
export const EMAIL: Network = "mailto:?subject=@t&body=@u%0D%0A@d";
export const EVERNOTE: Network = "https://www.evernote.com/clip.action?url=@u&title=@t";
export const BLUESKY: Network = "https://bsky.app/intent/compose?text=@t%0D%0A@u%0D%0A@d";
export const FACEBOOK: Network =
"https://www.facebook.com/sharer/sharer.php?u=@u&title=@t&description=@d&quote=@q&hashtag=@h";
export const FLIPBOARD: Network =
Expand All @@ -38,6 +39,7 @@ export const STUMBLEUPON: Network = "https://www.stumbleupon.com/submit?url=@u&t
export const TELEGRAM: Network = "https://t.me/share/url?url=@u&text=@t%0D%0A@d";
export const TUMBLR: Network = "https://www.tumblr.com/share/link?url=@u&name=@t&description=@d";
export const TWITTER: Network = "https://twitter.com/intent/tweet?text=@t&url=@u&hashtags=@h@tu";
export const X: Network = "https://www.x.com/intent/tweet?text=@t&url=@u&hashtags=@h@tu";
export const VIBER: Network = "viber://forward?text=@t%0D%0A@u%0D%0A@d";
export const VK: Network =
"https://vk.com/share.php?url=@u&title=@t&description=@d&image=@m&noparse=true";
Expand Down
Loading