2.4.1 • Published 3 years ago

react-dadan-sdk v2.4.1

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
3 years ago

React Dadan SDK

A lightweight React package which used for checking, validating, and manipulating Google Dadan Extension with React.

Install

npm install react-dadan-sdk
Or
yarn add react-dadan-sdk

Usage

In Your component import the following

import React, { useState } from "react";
import { RecordVideoButton } from "react-dadan-sdk";

In Your component add RecordVideoButton as below

function App() {
  const [videos, setVideos] = useState([]);
  return (
    <>
      <RecordVideoButton
        showSvg={true}
        title="Select Video"
        copyToClipboard={true}
        showPreview={true}
        type="select"
        buttonClass="dd__record__button__default__class"
        buttonStyle={{}}
        onFailure={handleResponse}
        onSuccess={handleResponse}
      />
    </>
  );
}

the handleResponse function , is a callback function which accept object with three parameters

function handleResponse({ success, data, message }) {
  if (success) {
    // only false when user close extension
    if (data) {
      // represnts the selected videos , or recorded video object after stop recording
      setVideos(data);
    }
  } else {
    setVideos([]);
    console.error(message); //User Closed Extension
  }
}

Record Button Props

ParameterTypeDescription
typestringRequired. either record or select , else will show error
titlestringOptional. button title
buttonClassstringOptional. the default class , or your custom class
buttonStyleobjectOptional. the default style , or your custom style as string
showSvgbooleanOptional. to show Svg icon in button
showPreviewbooleanOptional. to show preview dialog of recorded video
copyToClipboardbooleanOptional. to notify user that video shared url was copied to clipboard as toast message

License

MIT

2.3.0

3 years ago

2.2.0

3 years ago

2.4.1

3 years ago

2.4.0

3 years ago

2.1.0

3 years ago

2.0.0

3 years ago

1.0.0

3 years ago