1.0.0 • Published 2 years ago

react-floating-whatsapp-skolmi-dev-1 v1.0.0

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

React Floating Whatsapp

Simple react component for adding a floating WhatsApp button to your project.

NPM npm bundle size GitHub

Install

npm

npm i react-floating-whatsapp

Yarn

yarn add react-floating-whatsapp

Changes

  • Added: Default Avatar using generated random avatars
  • Added: New Prop height that allow to control the chat box height.
  • Added: New Prop notification that enable/disable repeated notifications sound and indicators.
  • Added: New Prop notificationDelay to set the time delay between notifications in millisecond.
  • Added: New Prop notificationSound to allow notifications sound.
  • Added: Message typing effect before chatMessage appears.
  • Fixed: Chat box css position Thanks to @jpmedeirosmorais and @jorgemndoza
  • Modified: Refactor state using useReducer Hook.
  • Modified: Prevent toggle open/close the chat box.
  • Modified: CSS stylesheet import, now its applied inline.
  • Updated: App dependencies
  • Added defaultMessage prop to allow for a prefilled message.

Usage

import React from 'react'
import FloatingWhatsApp from 'react-floating-whatsapp'

export default function App() {

  return (
      <FloatingWhatsApp {/*  Props  */} />
  )
}

Props

PropTypeOptionsDescriptionDefault
phoneNumberStringRequiredPhone number in intenational format1234567890
accountNameStringRequiredAccount usernameAccount Name
avatarStringOptionalChange user avatar using static assetsUI Faces
statusMessageStringOptionalText below the account usernameTypically replies within 1 hour
chatMessageStringOptionalText inside the chat box.Hello there! 🤝 \nHow can we help?
placeholderStringOptionalInput placeholder.Type a message..
darkModeBooleanOptionalDark style.false
allowClickAwayBooleanOptionalCloses the chat box when user clicks outsidefalse
allowEscBooleanOptionalCloses the chat box when Escape key is pressedfalse
classNameStringOptionalCSS className applied to the main wrapping Divcustom-class
stylesCSSPropertiesOptionalInline style applied to the Button only{}
heightNumberOptionalControl chat box height300
notificationBooleanOptionalAllow repeated notifications (Disabled after user opens the chat box)false
notificationDelayNumberOptionalTime delay between notifications in millisecond18000
notificationSoundBooleanOptionalAllow notification soundfalse
defaultMessageStringOptionalA default prefilled message.Hello, I have a query

Edit react-floating-whatsapp

License

MIT © awran5