0.0.4 • Published 6 years ago

react-social-media-bar v0.0.4

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

React Social Media Bar

react-social-media-bar is a React component to create external social media links

Features

  • uses Font Awesome brand icons
  • customizable overall and within each icon (as per colors, sizes, opacities, etc.)

Version

  • this is the first version of react-social-media-bar

Table of Contents

Installation

  1. Install React Social Media Bar as a dependency
# NPM
npm install react-social-media-bar --save

# Yarn
yarn add react-social-media-bar
  1. Import the react-social-media-bar module
// ES6
import SocialMediaBar from 'react-social-media-bar';
  1. Import Font Awesome into your project. I recommend using the CDN. See here for directions.

Examples

Live demo: to be implemented To build the examples locally, clone this repo. Then run:

npm install
cd examples
npm install
npm start

Then open localhost:3000 in a browser window.

Props

Properties are passed into the SocialMediaBar as follows. These are the default values for each property. Note that not all properties are required.

<SocialMediaBar
  icons={[]}
  bgColor="rgba(0, 0, 0, 0)"
  iconColor="#000"
  iconOpacity={1}
  iconSize="1em"
  hoverColor="#000"
  hoverOpacity={1}
  margin={{top: '5px', right: '5px', bottom: '5px', left: '5px'}}
  padding={{top: '0px', right: '0px', bottom: '0px', left: '0px'}}
  sameTab={false}
  vertical={false}
/>
PropertyTypeRequiredDefaultDescription
iconsArrayyes[]The icons that will be rendered. See below for format.
bgColorStringnorgba(0, 0, 0, 0)The background color of the component.
iconColorStringno#000The color of each icon in the icons array when hovered over.
iconOpacityIntegerno1The opacity of each icon in the icons array when hovered over.
iconSizeStringno1emThe size of each icon in the icons array.
hoverColorStringno#000The color of an icon in the icons array when hovered over.
hoverOpacityIntegerno1The opacity of an icon in the icons array when hovered over.
marginObjectno{top: '5px', right: '5px', bottom: '5px', left: '5px'}The margin on each icon in the icons array.
paddingObjectno{top: '0px', right: '0px', bottom: '0px', left: '0px'}The padding on each icon in the icons array.
sameTabBooleannofalseIf true, clicking on an icon will open its corresponding media link in the same tab. If false (by default), media links will open in a new tab.
verticalBooleannofalseIf true, the icons will be rendered vertically in a column. If false (by default), the icons will be rendered horizontally in a row.

Icons Property

The icons property is an Array of Objects in which each Object represents an icon to be included in this component. Each icon Object has the following key-value pairs. Note that if a key is not specified in this Object, the key inherits the value given to its corresponding property from the table above. If the property was not defined, the key is given the default value listed in the table above. For more clarification, please see the Examples.

KeyValue TypeRequiredDescription
mediaStringyesThe Font Awesome icon name of the social media (i.e. 'github', 'facebook-official', 'youtube', ...)
linkStringyesThe URL to which this icon will link
iconColorStringnoThe color of this icon when hovered over.
iconOpacityIntegernoThe opacity of this icon when hovered over.
iconSizeStringnoThe size of this icon.
hoverColorStringnoThe color of this icon when hovered over.
hoverOpacityIntegernoThe opacity of this icon when hovered over.
marginObjectnoThe margin on this icon.
paddingObjectnoThe padding on this icon.
sameTabBooleannoIf true, clicking on this icon will open its link URL in the same tab. If false the link URL will open in a new tab.

Credits

  • Dave Gandy, the awesome creator of Font Awesome
  • Alan Smith and Noel Broda, who wrote articles on Medium to guide me through creating and publishing this React Component
0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago