0.1.0 • Published 3 years ago
use-utterances-ref v0.1.0
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-refWith yarn
yarn add use-utterances-refUsage
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.
| Key | Type | Default | Description |
|---|---|---|---|
| issueTerm | "pathname" | "url" | "title" | "og:title" | string | "pathname" | The mapping between blog posts and GitHub issues. |
| issueNumber | string | If issueTerm is set, it is invalid. | |
| label | string | The 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> | nullLicense
MIT
0.1.0
3 years ago