GithubHelp home page GithubHelp logo

olremproj / next-share Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bunlong/next-share

0.0 0.0 0.0 417 KB

Social media share buttons for your next React apps.

License: MIT License

JavaScript 13.68% TypeScript 81.11% CSS 3.27% HTML 1.94%

next-share's Introduction

next-share

Social media share buttons for your next React apps.

downloads downloads

NPM npm bundle size Build Status JavaScript Style Guide

next-share

๐ŸŽ Features

  • No dependencies
  • Compatible with both JavaScript and TypeScript
  • Share buttons for your next React app
    • Facebook
    • Line
    • Pinterest
    • Reddit
    • Telegram
    • Tumblr
    • Twitter
    • Viber
    • Weibo
    • Whatsapp
    • Linkedin
    • VKShare
    • Livejournal
    • Workplace
    • Pocket
    • Instapaper
    • Hatena
    • FacebookMessenger
    • Email
    • Gab
  • Share counts
    • FacebookShareCount
    • HatenaShareCount
    • OKShareCount
    • PinterestShareCount
    • TumblrShareCount
    • VKShareCount

๐Ÿ”ง Install

next-share is available on npm. It can be installed with the following command:

npm install next-share --save

next-share is available on yarn as well. It can be installed with the following command:

yarn add next-share --save

๐Ÿ’ก Usage of ShareButton

๐ŸŽ€ Facebook

๐Ÿ‘จโ€๐Ÿ’ป Code

import {
  FacebookShareButton,
  FacebookIcon,
} from 'next-share';

<FacebookShareButton
  url={'https://github.com/next-share'}
  quote={'next-share is a social share buttons for your next React apps.'}
  hashtag={'#nextshare'}
>
  <FacebookIcon size={32} round />
</FacebookShareButton>

๐Ÿ“– FacebookShareButton props

Props Type Default Description Required
children node React component, HTML element or string. โœ…
url string The URL of the shared page. โœ…
quote string A quote to be shared. โŒ
hashtag string Hashtag to be shared. โŒ
windowWidth number 550 Opened window width. โŒ
windowHeight number 400 Opened window height. โŒ

๐ŸŽ€ Line

๐Ÿ‘จโ€๐Ÿ’ป Code

import {
  LineShareButton,
  LineIcon,
} from 'next-share';

<LineShareButton
  url={'https://github.com/next-share'}
  title={'next-share is a social share buttons for your next React apps.'}
>
  <LineIcon />
</LineShareButton>

๐Ÿ“– LineShareButton props

Props Type Default Description Required
children node React component, HTML element or string. โœ…
url string The URL of the shared page. โœ…
title string The title of the shared page. โŒ
windowWidth number 500 Opened window width. โŒ
windowHeight number 500 Opened window height. โŒ

๐Ÿ“– LineIcon props

๐ŸŽ€ Pinterest

๐Ÿ‘จโ€๐Ÿ’ป Code

import {
  PinterestShareButton,
  PinterestIcon,
} from 'next-share'

<PinterestShareButton
  url={'https://github.com/next-share'}
  media={'next-share is a social share buttons for your next React apps.'}
>
  <PinterestIcon size={32} round />
</PinterestShareButton>

๐Ÿ“– PinterestShareButton props

Props Type Default Description Required
children node React component, HTML element or string. โœ…
url string The URL of the shared page. โœ…
media string The image URL that will be pinned. โœ…
description string The description of the shared media. โŒ
windowWidth number 1000 Opened window width. โŒ
windowHeight number 730 Opened window height. โŒ

๐ŸŽ€ Reddit

๐Ÿ‘จโ€๐Ÿ’ป Code

import {
  RedditShareButton,
  RedditIcon,
} from 'next-share'

<RedditShareButton
  url={'https://github.com/next-share'}
  title={'next-share is a social share buttons for your next React apps.'}
>
  <RedditIcon size={32} round />
</RedditShareButton>

๐Ÿ“– RedditShareButton props

Props Type Default Description Required
children node React component, HTML element or string. โœ…
url string The URL of the shared page. โœ…
title string The title of the shared page. โŒ
windowWidth number 660 Opened window width. โŒ
windowHeight number 460 Opened window height. โŒ

๐ŸŽ€ Telegram

๐Ÿ‘จโ€๐Ÿ’ป Code

import {
  TelegramShareButton,
  TelegramIcon,
} from 'next-share'

<TelegramShareButton
  url={'https://github.com/next-share'}
  title={'next-share is a social share buttons for your next React apps.'}
>
  <TelegramIcon size={32} round />
</TelegramShareButton>

๐Ÿ“– TelegramShareButton props

Props Type Default Description Required
children node React component, HTML element or string. โœ…
url string The URL of the shared page. โœ…
title string The title of the shared page. โŒ
windowWidth number 550 Opened window width. โŒ
windowHeight number 400 Opened window height. โŒ

๐ŸŽ€ Tumblr

๐Ÿ‘จโ€๐Ÿ’ป Code

import {
  TumblrShareButton,
  TumblrIcon,
} from 'next-share'

<TumblrShareButton
  url={'https://github.com/next-share'}
  title={'next-share is a social share buttons for your next React apps.'}
>
  <TumblrIcon size={32} round />
</TumblrShareButton>

๐Ÿ“– TumblrShareButton props

Props Type Default Description Required
children node React component, HTML element or string. โœ…
url string The URL of the shared page. โœ…
title string The title of the shared page. โŒ
tags Array<string> โŒ
caption string The description of the shared page. โŒ
posttype string link โŒ
windowWidth number 660 Opened window width. โŒ
windowHeight number 460 Opened window height. โŒ

๐ŸŽ€ Twitter

๐Ÿ‘จโ€๐Ÿ’ป Code

import {
  TwitterShareButton,
  TwitterIcon,
} from 'next-share'

<TwitterShareButton
  url={'https://github.com/next-share'}
  title={'next-share is a social share buttons for your next React apps.'}
>
  <TwitterIcon size={32} round />
</TwitterShareButton>

๐Ÿ“– TwitterShareButton props

Props Type Default Description Required
children node React component, HTML element or string. โœ…
url string The URL of the shared page. โœ…
title string The title of the shared page. โŒ
via string โŒ
hashtags array โŒ
related array โŒ
windowWidth number 550 Opened window width. โŒ
windowHeight number 400 Opened window height. โŒ

๐ŸŽ€ Viber

๐Ÿ‘จโ€๐Ÿ’ป Code

import {
  ViberShareButton,
  ViberIcon,
} from 'next-share'

<ViberShareButton
  url={'https://github.com/next-share'}
  title={'next-share is a social share buttons for your next React apps.'}
>
  <ViberIcon size={32} round />
</ViberShareButton>

๐Ÿ“– ViberShareButton props

Props Type Default Description Required
children node React component, HTML element or string. โœ…
url string The URL of the shared page. โœ…
title string The title of the shared page. โŒ
separator โŒ
windowWidth number 660 Opened window width. โŒ
windowHeight number 460 Opened window height. โŒ

๐Ÿ“– ViberIcon props

๐ŸŽ€ Weibo

๐Ÿ‘จโ€๐Ÿ’ป Code

import {
  WeiboShareButton,
  WeiboIcon,
} from 'next-share'

<WeiboShareButton
  url={'https://github.com/next-share'}
  title={'next-share is a social share buttons for your next React apps.'}
  image={`${String(window.location)}/${example-image}`}
>
  <WeiboIcon size={32} round />
</WeiboShareButton>

๐Ÿ“– WeiboShareButton props

Props Type Default Description Required
children node React component, HTML element or string. โœ…
url string The URL of the shared page. โœ…
title string The title of the shared page. โŒ
image string The image URL that will be shared. โŒ
windowWidth number 660 Opened window width. โŒ
windowHeight number 550 Opened window height. โŒ

๐Ÿ“– WeiboIcon props

๐ŸŽ€ Whatsapp

๐Ÿ‘จโ€๐Ÿ’ป Code

import {
  WhatsappShareButton,
  WhatsappIcon,
} from 'next-share'

<WhatsappShareButton
  url={'https://github.com/next-share'}
  title={'next-share is a social share buttons for your next React apps.'}
  separator=":: "
>
  <WhatsappIcon size={32} round />
</WhatsappShareButton>

๐Ÿ“– WhatsappShareButton props

Props Type Default Description Required
children node React component, HTML element or string. โœ…
url string The URL of the shared page. โœ…
title string The title of the shared page. โŒ
separator string โŒ
windowWidth number 550 Opened window width. โŒ
windowHeight number 400 Opened window height. โŒ

๐ŸŽ€ Linkedin

๐Ÿ‘จโ€๐Ÿ’ป Code

import {
  LinkedinShareButton,
  LinkedinIcon,
} from 'next-share'

<LinkedinShareButton url={'https://github.com/next-share'}>
  <LinkedinIcon size={32} round />
</LinkedinShareButton>

๐Ÿ“– LinkedinShareButton props

Props Type Default Description Required
children node React component, HTML element or string. โœ…
url string The URL of the shared page. โœ…
title string The title of the shared page. โŒ
summary string Description of the shared page. โŒ
source string Source of the content (e.g. your website or application name). โŒ
windowWidth number 750 Opened window width. โŒ
windowHeight number 600 Opened window height. โŒ

๐ŸŽ€ VK

๐Ÿ‘จโ€๐Ÿ’ป Code

import {
  VKShareButton,
  VKIcon,
} from 'next-share'

<VKShareButton
  url={'https://github.com/next-share'}
  image={'./next-share.png'}
>
  <VKIcon size={32} round />
</VKShareButton>

๐Ÿ“– VKShareButton props

Props Type Default Description Required
children node React component, HTML element or string. โœ…
url string The URL of the shared page. โœ…
title string The title of the shared page. โŒ
image string An absolute link to the image that will be shared. โŒ
noParse boolean If true is passed, VK will not retrieve URL information. โŒ
noVkLinks boolean If true is passed, there will be no links to the user's profile in the open window. Only for mobile devices. โŒ
windowWidth number 660 Opened window width. โŒ
windowHeight number 460 Opened window height. โŒ

๐Ÿ“– VKIcon props

๐ŸŽ€ Mailru

๐Ÿ‘จโ€๐Ÿ’ป Code

import {
  MailruShareButton,
  MailruIcon,
} from 'next-share'

<MailruShareButton
  url={'https://github.com/next-share'}
  title={'Next Share'}
>
  <MailruIcon size={32} round />
</MailruShareButton>

๐Ÿ“– MailruShareButton props

Props Type Default Description Required
children node React component, HTML element or string. โœ…
url string The URL of the shared page. โœ…
title string The title of the shared page. โŒ
description string Description of the shared page. โŒ
imageUrl string Image url of the shared page. โŒ
windowWidth number 660 Opened window width. โŒ
windowHeight number 460 Opened window height. โŒ

๐ŸŽ€ Livejournal

๐Ÿ‘จโ€๐Ÿ’ป Code

import {
  LivejournalShareButton,
  LivejournalIcon,
} from 'next-share'

<LivejournalShareButton
  url={'https://github.com/next-share'}
  title={'Next Share'}
  description={'https://github.com/next-share'}
>
  <LivejournalIcon size={32} round />
</LivejournalShareButton>

๐Ÿ“– LivejournalShareButton props

Props Type Default Description Required
children node React component, HTML element or string. โœ…
url string The URL of the shared page. โœ…
title string The title of the shared page. โŒ
description string Description of the shared page. โŒ
windowWidth number 660 Opened window width. โŒ
windowHeight number 460 Opened window height. โŒ

๐ŸŽ€ Workplace

๐Ÿ‘จโ€๐Ÿ’ป Code

import {
  WorkplaceShareButton,
  WorkplaceIcon,
} from 'next-share'

<WorkplaceShareButton
  url={'https://github.com/next-share'}
  quote={'Next Share'}
>
  <WorkplaceIcon size={32} round />
</WorkplaceShareButton>

๐Ÿ“– WorkplaceShareButton props

Props Type Default Description Required
children node React component, HTML element or string. โœ…
url string The URL of the shared page. โœ…
quote string โŒ
hashtag string โŒ
windowWidth number 550 Opened window width. โŒ
windowHeight number 400 Opened window height. โŒ

๐ŸŽ€ Pocket

๐Ÿ‘จโ€๐Ÿ’ป Code

import {
  PocketShareButton,
  PocketIcon,
} from 'next-share'

<PocketShareButton
  url={'https://github.com/next-share'}
  title={'Next Share'}
>
  <PocketIcon size={32} round />
</PocketShareButton>

๐Ÿ“– PocketShareButton props

Props Type Default Description Required
children node React component, HTML element or string. โœ…
url string The URL of the shared page. โœ…
title string Title of the shared page. Note that if Pocket detects a title tag on the page being saved, this parameter will be ignored and the title tag of the saved page will be used instead. โŒ
windowWidth number 500 Opened window width. โŒ
windowHeight number 500 Opened window height. โŒ

๐ŸŽ€ Instapaper

๐Ÿ‘จโ€๐Ÿ’ป Code

import {
  InstapaperShareButton,
  InstapaperIcon,
} from 'next-share'

<InstapaperShareButton
  url={'https://github.com/next-share'}
  title={'Next Share'}
>
  <InstapaperIcon size={32} round />
</InstapaperShareButton>

๐Ÿ“– InstapaperShareButton props

Props Type Default Description Required
children node React component, HTML element or string. โœ…
url string The URL of the shared page. โœ…
title string Title of the shared page. โŒ
description string Description of the shared page. โŒ
windowWidth number 500 Opened window width. โŒ
windowHeight number 500 Opened window height. โŒ

๐ŸŽ€ Hatena

๐Ÿ‘จโ€๐Ÿ’ป Code

import {
  HatenaShareButton,
  HatenaIcon,
} from 'next-share'

<HatenaShareButton
  url={'https://github.com/next-share'}
  title={'Next Share'}
>
  <HatenaIcon size={32} round />
</HatenaShareButton>

๐Ÿ“– HatenaShareButton props

Props Type Default Description Required
children node React component, HTML element or string. โœ…
url string The URL of the shared page. โœ…
title string Title of the shared page. โŒ
windowWidth number 660 Opened window width. โŒ
windowHeight number 460 Opened window height. โŒ

๐ŸŽ€ FacebookMessenger

๐Ÿ‘จโ€๐Ÿ’ป Code

import {
  FacebookMessengerShareButton,
  FacebookMessengerIcon,
} from 'next-share'

<FacebookMessengerShareButton
  url={'https://github.com/next-share'}
  appId={''}
>
  <FacebookMessengerIcon size={32} round />
</FacebookMessengerShareButton>

๐Ÿ“– FacebookMessengerShareButton props

Props Type Default Description Required
children node React component, HTML element or string. โœ…
url string The URL of the shared page. โœ…
appId string Facebook application id. โœ…
redirectUri string The URL to redirect to after sharing (default: the shared url). โŒ
to string A user ID of a recipient. Once the dialog comes up, the sender can specify additional people as recipients. โŒ
windowWidth number 1000 Opened window width. โŒ
windowHeight number 820 Opened window height. โŒ

๐ŸŽ€ Email

๐Ÿ‘จโ€๐Ÿ’ป Code

import {
  EmailShareButton,
  EmailIcon,
} from 'next-share'

<EmailShareButton
  url={'https://github.com/next-share'}
  subject={'Next Share'}
  body="body"
>
  <EmailIcon size={32} round />
</EmailShareButton>

๐Ÿ“– EmailShareButton props

Props Type Default Description Required
children node React component, HTML element or string. โœ…
url string The URL of the shared page. โœ…
subject string โŒ
body string โŒ
separator string โŒ

๐Ÿ“– EmailIcon props

๐ŸŽ€ Gab

๐Ÿ‘จโ€๐Ÿ’ป Code

import {
  GabShareButton,
  GabIcon,
} from 'next-share'

<GabShareButton
  url={'https://github.com/next-share'}
  title={'Next Share'}
>
  <GabIcon size={32} round />
</GabShareButton>

๐Ÿ“– GabShareButton props

Props Type Default Description Required
children node React component, HTML element or string. โœ…
url string The URL of the shared page. โœ…
title string Title of the shared page. โŒ
windowWidth number 660 Opened window width. โŒ
windowHeight number 640 Opened window height. โŒ

๐Ÿ“– GabIcon props

๐Ÿ“š Icons props

Props Type Default Description Required
size number Icon size in pixels. โŒ
round boolean Show round or rectangle. โŒ
borderRadius number Set rounded corners if using round icon. โŒ
bgStyle object Customize background style. โŒ
iconFillColor string white Customize icon fill color. โŒ

๐Ÿ’ก Usage of ShareCount

๐Ÿ‘จโ€๐Ÿ’ป Code

import {
  FacebookShareCount,
  HatenaShareCount,
  OKShareCount,
  PinterestShareCount,
  TumblrShareCount,
  VKShareCount,
} from 'next-share';

<PinterestShareCount url={'https://github.com/next-share'} />

<PinterestShareCount url={'https://github.com/next-share'}>
  {shareCount => <span className="wrapper">{shareCount}</span>}
</PinterestShareCount>

<FacebookShareCount
  url={'https://github.com/next-share'}
  appId={''}
  appSecret={''}
/>

<FacebookShareCount
  url={'https://github.com/next-share'}
  appId={''}
  appSecret={''}
>
  {shareCount => <span className="wrapper">{shareCount}</span>}
</FacebookShareCount>

๐Ÿ“– FacebookShareCount props

Props Type Default Description Required
url string The URL of the shared page. โœ…
appId string Facebook application id. โœ…
appSecret string Facebook application secret. โœ…
children node React component, HTML element or string. โŒ

๐Ÿ“œ Changelog

Latest version 0.18.1 (2022-09-01):

  • Update reddit icon color to match current branding

Details changes for each release are documented in the CHANGELOG.md.

๐Ÿ’– Wrap Up

If you think any of the next-share can be improved, please do open a PR with any updates and submit any issues. Also, I will continue to improve this, so you might want to watch/star this repository to revisit.

๐ŸŒŸ Contribution

We'd love to have your helping hand on contributions to next-share by forking and sending a pull request!

Your contributions are heartily โ™ก welcome, recognized and appreciated. (โœฟโ— โ€ฟโ— )

How to contribute:

  • Open pull request with improvements
  • Discuss ideas in issues
  • Spread the word
  • Reach out with any feedback

โœจ Contributors

Bunlong
Bunlong
Arturs Kirtovskis
Arturs Kirtovskis
Sean
Sean
Steve Scavo
Steve Scavo
Maddy Miller
Maddy Miller

โš–๏ธ License

The MIT License License: MIT

next-share's People

Contributors

bunlong avatar me4502 avatar stevescavo avatar akirtovskis avatar chella89 avatar helloitsm3 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.