ta-react-share-buttons
v1.0.2
Published
Renders a collection of social sharing buttons.
Downloads
7
Readme
Modules
Classes
Members
Constants
Functions
ShareButtons/displayTypes
List possible display types
ShareButtons
Renders a collection of social sharing buttons.
Version: 1.0
ShareButtons/supportedCommunities
List supported communities
ShareButtons
Kind: global class
new ShareButtons(props)
Renders social sharing buttons.
| Param | Type | Description | | --- | --- | --- | | props | Object | See ShareButtons.propTypes |
default
The communities this setup currently supports (i.e. with icons or the shareActionFactory.
Kind: global variable
HORIZONTAL_ICONS : enum
Virtual enums – used to define the different forms a sharing button/icon can take when being shown.
Kind: global enum
Read only: true
minimumShares : number
Share count number is only being shown if greater than this constant.
Kind: global constant
ShareItem() ⇒ XML
A share item is a single sharing item, consisting of a link with an icon. Using display types, this item can be displayed in different ways, either as a list item or as a button.
Kind: global function
| Param | Type | Description | | --- | --- | --- | | props.displayType | string | Either {@see HORIZONTAL_ICONS} or {@see VERTICAL_BUTTONS}. | | props.inverted | boolean | If share items should be shown inverted. | | props.type | string | Can currently be facebook or twitter. | | props.count | number | Number of shares, if available. | | props.description | string | Description – used as activator («Auf Twitter teilen») | | props.shareUrl | string | The action URL that should be opened when clicking the button link. |
Renders a collection of social sharing buttons.
Installation
yarn add ta-react-share-buttons
Usage
import ShareButtons, * as shareButtonsSupportLibrary from 'ta-react-share-buttons';
//...
class YourComponent extends React.Component {
render() {
return (
<ShareButtons
hashtags={['TAGrafik', 'ddj']}
displayType={shareButtonsSupportLibrary.HORIZONTAL_ICONS}/>
)
}
}
Remarks
Display Type
Currently available values:
- 'horizontal icons'
- 'vertical buttons'
To simplify working with these values, you can use the enums defined in the module. See Usage for an example of how to do that.
Communities
The default communities are these:
[
{
type: 'twitter',
description: 'Bei Twitter veröffentlichen',
count: 0
},
{
type: 'facebook',
description: 'Über Facebook teilen',
facebook_id: 147124108642216,
count: 0
}
]
Community objects need at least a type
property to work.
Currently supported community types are
twitter
facebook
The communities
property is modeled after the Newsnet Sharing API, so that
the response of that API can easily be dumped into this component.