0.1.0 • Published 1 year ago

use-utterances-ref v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

useUtterancesRef

A custom hook to make utterances available in React apps

⚠️ ️You must install the GitHub Apps for utterances before using this library from here.

Installation

With npm

npm i use-utterances-ref

With yarn

yarn add use-utterances-ref

Usage

import { useUtterancesRef } from "use-utterances-ref";

const ref = useUtterancesRef<HTMLDivElement>("user/public-repo");

return <div ref={ref} />;

API

useUtterancesRef(repository_name, options);

Arguments

repository_name

A public GitHub repository. This is where the blog post issues and issue-comments will be posted.

Required. Set like "owner/repo"

options

All options is optional. See here for more details on options.

KeyTypeDefaultDescription
issueTerm"pathname" | "url" | "title" | "og:title" | string"pathname"The mapping between blog posts and GitHub issues.
issueNumberstringIf issueTerm is set, it is invalid.
labelstringThe label that will be assigned to issues created by Utterances.
theme"github-light" | "github-dark" | "preferred-color-scheme" | "github-dark-orange" | "icy-dark" | "dark-blue" | "photon-dark" | "boxy-light" | "gruvbox-dark""github-light"A Theme that matches your blog.

Returns

React.MutableRefObject<T extends HTMLElement | null> | null

License

MIT

0.1.0

1 year ago