1.0.1 • Published 6 years ago

cnk-floating-button v1.0.1

Weekly downloads
4
License
ISC
Repository
github
Last release
6 years ago

CNK-Floating-Button

An animated button component built with React.

cnk-floating-button

Installation

npm install cnk-floating-button --save

Example

import  React  from  "react";
import { render } from  "react-dom";
import  CNKFloatingButton  from  "../../src";

const  buttonConfigurations  = {
	button1: {
		iconName:  "home",
		onClick: () => {
			console.log("Button1: Clicked");
		}
	},
	button2: {
		iconName:  "phone",
		onClick: () => {
			console.log("Button2: Clicked");
		}
	},
	button3: {
		iconName:  "envelope",
		onClick: () => {
			console.log("Button3: Clicked");
		}
	},
	button4: {
		iconName:  "star",
		onClick: () => {
			console.log("Button4: Clicked");
		}
	}
};

const  App  = () => (
		<CNKFloatingButton
			iconName="sidebar"
			button1={buttonConfigurations.button1}
			button2={buttonConfigurations.button2}
			button3={buttonConfigurations.button3}
			button4={buttonConfigurations.button4} />
);

render(<App />, document.getElementById("root"));

Component Props

PropValue
textString: Label of the main button
iconNameString: Icon name of the main button. We use semantic ui library for icons.
sizeNumber: Width and Height's value of main button. One value for all of them.
fontSizeNumber: Font Size of the Text or Icon.
button1Object: Child button configuration for top-left
button2Object: Child button configuration for top-right
button3Object: Child button configuration for bottom-left
button4Object: Child button configuration for bottom-right

Note: At least one button configuration must be valid

Child Button Configuration

PropValue
textString: Label of the button
iconNameString: Icon name of the button. We use semantic ui library for icons.
fontSizeNumber: Font Size of the Text or Icon.
onClickFunction: OnClick event for the button.
backgroundColorString: Background Color of the Button. This must be valid css color.
foregroundColorString: Foreground Color of the Button for Text or Icon. This must be valid css color.
hoverBackgroundColorString: Hover effect background color of the button. This must be valid css color.