npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@hyvor/hyvor-talk-react

v0.0.3

Published

Hyvor Talk React Component

Downloads

2,161

Readme

Installation

npm install @hyvor/hyvor-talk-react

Usage

The library contains two components:

Comments

All props in the <Comments> component are the same as the base hyvor-talk-comments Web Component.

import React from 'react';
import { Comments } from '@hyvor/hyvor-talk-react';

const App = () => {
    return (
        <Comments
            website-id={YOUR_WEBSITE_ID}
            page-id={UNIQUE_PAGE_ID}
        />
    );
};

In addition, you can pass a on prop to listen to events emitted by the component.

<Comments
    website-id={YOUR_WEBSITE_ID}
    page-id={UNIQUE_PAGE_ID}
    on={{
        'loaded': () => console.log('Comments loaded'),
        'comment:published': () => console.log('Comment published'),
    }}
/>

Comment Counts

All props in the <CommentCount> component are the same as the base hyvor-talk-comment-count Web Component.

If you only have one <CommentCount> on the page, use the component directly:

import React from 'react';
import { CommentCount } from '@hyvor/hyvor-talk-react';

const App = () => {
    return (
        <CommentCount
            page-id={PAGE_ID}
            website-id={YOUR_WEBSITE_ID}
        />
    );
};

If you have multiple <CommentCount> in the page, use loading="manual" prop on each component and call loadCommentCounts() function when the components are mounted. This will reduce the number of API calls needed.

import React from 'react';
import { CommentCount, loadCommentCounts } from '@hyvor/hyvor-talk-react';

const App = () => {

    useEffect(() => {
        loadCommentCounts({
            'website-id': YOUR_WEBSITE_ID,
        });
    }, []);

    return (
        <div>
            <CommentCount
                page-id={PAGE_ID_1}
                loading="manual"
            />
            <CommentCount
                page-id={PAGE_ID_2}
                loading="manual"
            />
        </div>
    );
};

loadCommentCounts function has the following signature:

loadCommentCounts(
    options: {
        "website-id"?: number,
        mode?: 'text' | 'number',
        language?: string,
    } = {},
    callback: ((count: number | string, el: Element) => string | number) | null = null
): void

See the comment counts documentation for more details.