-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Overhaul MetaHeadEmbed + Fix getShareUrl's (#5)
* Update README * Update to use PageLayout * Implement render support + overhauled embeds * Update README * Fix README * Tweak * Refactor sharing * Tweaks * Add hashtag check * Update README
- Loading branch information
Showing
8 changed files
with
229 additions
and
191 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export const commaSeparate = (words?: string | string[]) => | ||
typeof words === "string" ? words : words?.join(","); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,30 @@ | ||
import { BaseShareProps } from "../types"; | ||
import { commaSeparate } from "../utils"; | ||
import objectToUrlParams from "./objectToUrlParams"; | ||
|
||
export interface TwitterProps extends BaseShareProps { | ||
/** Text to show in card. */ | ||
text?: string; | ||
|
||
/** Hashtags to show in Twitter card. */ | ||
hashtags?: string[]; | ||
/** | ||
* Hashtags to show in Twitter card. | ||
* Example: `"your, tags"` or `["your", "tags"]`. | ||
*/ | ||
hashtags?: string | string[]; | ||
|
||
/** Accounts to recommend following. */ | ||
related?: string[]; | ||
/** | ||
* Accounts to recommend following. | ||
* Example: `"your, tags"` or `["your", "tags"]`. | ||
*/ | ||
related?: string | string[]; | ||
} | ||
|
||
export const getTwitterUrl = ({ url, text, hashtags, related }: TwitterProps) => | ||
`https://twitter.com/share${objectToUrlParams({ | ||
url, | ||
text, | ||
hashtags: hashtags?.join(","), | ||
related: related?.join(","), | ||
hashtags: commaSeparate(hashtags), | ||
related: commaSeparate(related), | ||
})}`; | ||
|
||
export default getTwitterUrl; |