Skip to content

A textbox built on top of Material UI that lets you choose a GIPHY, or Text.

License

Notifications You must be signed in to change notification settings

EliHood/materialui-gif-textbox

Repository files navigation

Material UI Text/Gif/Attachment Comment Box

Component that is built on top of Material UI, and React Giphy Searchbox.

Install

npm i material-ui-gif-textbox

Basic Example

import CommentBox from "material-ui-gif-textbox";
function App() {
  const [commentBody, setCommentBody] = useState("");
  const [gifUrl, setGifUrl] = useState("");
  const [files, setFiles] = useState([]);
  const selectGif = React.useCallback(
    (e) => {
      setGifUrl(e.images.downsized_large.url);
      setCommentBody("");
    },
    [gifUrl, commentBody]
  );
  const commentChange = React.useCallback(
    (data) => {
      setGifUrl("");
      setCommentBody(data);
    },
    [gifUrl, commentBody]
  );
  const onSubmit = (e) => {
    e.preventDefault();
    const data = {
      url: gifUrl,
      content: commentBody,
      file: files,
    };
    console.log(data);
  };
  return (
    <CommentBox
      type="gif-comment"
      apiKey="9Ixlv3DWC1biJRI57RanyL7RTbfzz0o7"
      commentChange={(e) => commentChange(e.target.value)}
      content={commentBody}
      gifChange={selectGif}
      gifUrl={gifUrl}
      onSubmit={onSubmit}
      files={files}
      setFiles={setFiles}
      haveAttachment={true}
    />
  );
}

About

A textbox built on top of Material UI that lets you choose a GIPHY, or Text.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published