1.1.0 • Published 8 months ago

@rishabhdaliya/feedback-client v1.1.0

Weekly downloads
-
License
-
Repository
-
Last release
8 months ago

Here's a README template for your npm package @rishabhdaliya/feedback-client:

# @rishabhdaliya/feedback-client

![npm](https://img.shields.io/npm/v/@rishabhdaliya/feedback-client)
![npm](https://img.shields.io/npm/dt/@rishabhdaliya/feedback-client)

`@rishabhdaliya/feedback-client` is a React component for collecting user feedback and ratings through a customizable modal.

## Installation

You can install `@rishabhdaliya/feedback-client` using npm:

```bash
npm install @rishabhdaliya/feedback-client

Or, if you prefer using Yarn:

yarn add @rishabhdaliya/feedback-client

Usage

To integrate the Feedback component into your React application, follow these steps:

  1. Import the Feedback component into your application:

    import Feedback from '@rishabhdaliya/feedback-client';
  2. Use the Feedback component within your JSX:

    function App() {
      return (
        <div>
          <Feedback />
        </div>
      );
    }
  3. Customize the feedback modal by modifying the Feedback component's props.

  4. Start your application, and you can now toggle the feedback modal to collect user feedback.

Props

The Feedback component accepts the following props for customization:

  • isOpen (boolean): Controls whether the feedback modal is open.

  • onClose (function): A callback function that is triggered when the user closes the modal.

  • handleFeedbackSubmit (function): A callback function that is triggered when the user submits feedback. It receives the user's rating and text message as arguments.

  • Customize the appearance and behavior of the modal as needed by modifying the component's code directly.

Example

Here's a basic example of how to use the Feedback component:

import React, { useState } from 'react';
import Feedback from '@rishabhdaliya/feedback-client';

function App() {
  const [isOpen, setIsOpen] = useState(false);

  const handleFeedbackSubmit = (rating, text) => {
    // Handle feedback submission here
    console.log('Rating:', rating);
    console.log('Text:', text);
    setIsOpen(false); // Close the modal
  };

  const handleClose = () => {
    setIsOpen(false);
  };

  const handleOpen = () => {
    setIsOpen(true);
  };

  return (
    <div>
      <button onClick={handleOpen}>Toggle modal</button>
      <Feedback
        isOpen={isOpen}
        onClose={handleClose}
        handleFeedbackSubmit={handleFeedbackSubmit}
      />
    </div>
  );
}

export default App;

License

This project is licensed under the MIT License. See the LICENSE file for details.

Acknowledgments

Thank you for using @rishabhdaliya/feedback-client! We appreciate your feedback and contributions.

If you have any questions or encounter issues, please feel free to open an issue.

In this template, replace `@rishabhdaliya/feedback-client` with the actual name of your package, and make sure to customize the README with specific usage instructions, props, and any additional information that is relevant to your package. Also, include the correct license information and a link to your package's GitHub repository if applicable.
1.1.0

8 months ago

1.0.0

8 months ago

0.0.0

8 months ago