From 812ba451c2cc190824d3124ecf4c672b6f00572b Mon Sep 17 00:00:00 2001 From: Maddy Miller Date: Mon, 3 Feb 2025 20:25:09 +1000 Subject: [PATCH 1/2] feat(tumblr): add support for content field --- README.md | 1 + src/TumblrShareButton.tsx | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d5860201..1d3ab9b9 100644 --- a/README.md +++ b/README.md @@ -430,6 +430,7 @@ Optional props: - `tags` (`string[]`): Tags to attach to the post. - `caption` (`string`): Description shown with the shared page. - `posttype` (`string`, default `"link"`): Tumblr post type. +- `content` (`string`): The content for some post types. See [Tumblr's documentation](https://help.tumblr.com/knowledge-base/share-button-documentation/) for details. ```jsx import { TumblrShareButton, TumblrIcon } from "react-share"; diff --git a/src/TumblrShareButton.tsx b/src/TumblrShareButton.tsx index f469f664..6d37c948 100644 --- a/src/TumblrShareButton.tsx +++ b/src/TumblrShareButton.tsx @@ -10,7 +10,14 @@ function tumblrLink( caption, tags, posttype, - }: { title?: string; caption?: string; tags?: string; posttype?: 'link' | string }, + content, + }: { + title?: string; + caption?: string; + tags?: string; + posttype?: 'link' | string; + content?: string; + }, ) { assert(url, 'tumblr.url'); @@ -22,6 +29,7 @@ function tumblrLink( caption, tags, posttype, + content, }) ); } @@ -29,14 +37,15 @@ function tumblrLink( type Options = { title?: string; caption?: string; - posttype?: 'link' | string; + posttype?: 'link' | 'text' | 'quote' | 'photo' | 'chat' | 'video' | string; + content?: string; }; type TumblrShareButtonProps = Omit, 'title'> & Options & { tags?: string[] }; const TumblrShareButton = forwardRef( - ({ caption, posttype, tags, title, ...props }, ref) => ( + ({ caption, posttype, tags, title, content, ...props }, ref) => ( ( tags: (tags || []).join(','), caption, posttype: posttype || 'link', + content, }} windowHeight={460} windowWidth={660} From 625dcd1040dc958745977bdc7eb0704a451956f7 Mon Sep 17 00:00:00 2001 From: Maddy Miller Date: Mon, 3 Feb 2025 20:32:34 +1000 Subject: [PATCH 2/2] add changeset --- .changeset/spicy-ghosts-grin.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/spicy-ghosts-grin.md diff --git a/.changeset/spicy-ghosts-grin.md b/.changeset/spicy-ghosts-grin.md new file mode 100644 index 00000000..f614ff74 --- /dev/null +++ b/.changeset/spicy-ghosts-grin.md @@ -0,0 +1,5 @@ +--- +"react-share": minor +--- + +Add content field to TumblrShareButton