Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-feedback-popup

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-feedback-popup

A highly customizable React component to get user feedback via a popup

  • 1.0.8
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
17
decreased by-41.38%
Maintainers
1
Weekly downloads
 
Created
Source

This project was bootstrapped with Create React App and this React Feedback Component MIT NPM Version npm downloads build status code style: prettier PRs Welcome

Buy Me A Coffee

React-Feedback-Popup

React-Feedback-Popup is a blazingly fast and highly customizable component to get user feedback.

Collapsed Feedback Popup:

Demo tag

Expanded Feedback Popup:

Demo tag

Live Demo

Live Demo at Codesandbox

Features

  • Gets user name, email, rating.
  • User can determine the position (left or right)
  • User can determine the header, body, and button text as well as the number of star ratings.
  • Form validation (name, email, feedback and rating are required)

Why

I needed a "feedback component" for my projects. Since I was unable to find one which met my requirements (and the fact that I generally enjoy re-inventing the wheel) this is what I came up with.

Demo

Installation

The preferred way of using the component is via NPM

npm install --save react-feedback-popup

Usage

Here's a sample implementation that creates a custom popup on a dummy Create-React-App page.

import React from 'react';
import logo from './logo.svg';
import FeedBack from 'react-feedback-popup';
import './App.css';

function App() {
	return (
		<div className="App">
			<header className="App-header">
				<img src={logo} className="App-logo" alt="logo" />
				<p>
					Edit <code>src/App.js</code> and save to reload.
        </p>
				<a
					className="App-link"
					href="https://reactjs.org"
					target="_blank"
					rel="noopener noreferrer"
				>
					Learn React
        </a>
			</header>
			<FeedBack
				position="left"
				numberOfStars={5}
				headerText="Hello"
				bodyText="Custom Body test"
				buttonText="This is also custom"
				handleClose={() => console.log("handleclose")}
				handleSubmit={(data) => 
					fetch('https://formspree.io/moqjznjg', {
						headers: {
							Accept: 'application/json',
							'Content-Type': 'application/json'
						},
						method: 'POST', // or 'PUT'
						body: JSON.stringify(data),
					}).then((response) => { 
						if (!response.ok) {
							return Promise.reject('Our servers are having issues! We couldn\'t send your feedback!');
						}
						response.json()
					}).then(() => {
						alert('Success!');
					}).catch((error) => {
						alert('Our servers are having issues! We couldn\'t send your feedback!', error);
					})
				}
				handleButtonClick={() => console.log("handleButtonClick")}
			/>
		</div>
	);
}

export default App;

Options

OptionTypeDefaultDescription
positionStringrightPosition of the feedback pop. Possible options are right and left
numberOfStarsInteger5Number of rating stars to be displayed.
headerTextString"Have Feedback? 📝?"Text to be displayed on header when pop is expanded.
bodyTextString"Need help? Have feedback? I'm a human so please be nice and I'll fix it!"Text to be displayed on on the body when pop is expanded
buttonTextString"Feedback? ☝️"Text to be displayed on header when pop is no expanded
handleCloseFunctionThis function collapses the popupCalled when close button is clicked.
handleSubmitFunctionalert('Success!') or alert('Error')Called when submit button is clicked.
handleButtonClickFunction()Called when user clicks on Feedback button to expand the popup.

Sample Usage:

<FeedBack
	position="left"
	numberOfStars={5}
	headerText="Hello"
	bodyText="Custom Body test"
	buttonText="This is also custom"
	handleClose={() => console.log("handleclose")}
	handleSubmit={(data) => 
		fetch('https://formspree.io/moqjznjg', {
			headers: {
				Accept: 'application/json',
				'Content-Type': 'application/json'
			},
			method: 'POST', // or 'PUT'
			body: JSON.stringify(data),
		}).then((response) => { 
			if (!response.ok) {
				return Promise.reject('Our servers are having issues! We couldn\'t send your feedback!');
			}
			response.json()
		}).then(() => {
			alert('Success!');
		}).catch((error) => {
			alert('Our servers are having issues! We couldn\'t send your feedback!', error);
		})
	}
	handleButtonClick={() => console.log("handleButtonClick")}

/>

Dev

The component is written in ES6 and uses Webpack as its build tool.

Set up instructions
git clone git@github.com:ya332/react-feedback-popup.git
cd react-feedback-popup
npm install
npm run start

open http://localhost:3000

Contributing

Got ideas on how to make this better? Open an issue here! Issues, Pull Requests and all Comments are welcome!

Keywords

FAQs

Package last updated on 08 Jan 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc