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

comment-box-react

v1.0.1

Published

Made with create-react-library

Downloads

6

Readme

comment-box-react

Made with create-react-library

NPM JavaScript Style Guide

Comment-box-ract is package that you can easily import into your React app. type @ to activate a user search so you can tag a user. If you provide users they need to be in the following format:

[
  {
    username: 'df-username',
    avatar_url:
      'https://secure.gravatar.com/avatar/f04241571d95d005e4a54f4278670718?d=mm',
    name: 'John Doe'
  },
  {
    username: 'df-username2',
    avatar_url:
      'https://secure.gravatar.com/avatar/f04241571d95d005e4a54f4278670718?d=mm',
    name: 'John Doe 2'
  },
  {
    username: 'df-username3',
    avatar_url:
      'https://secure.gravatar.com/avatar/f04241571d95d005e4a54f4278670718?d=mm',
    name: 'John Doe 3'
  }
];

You can also etit text values in calse of localization for example. you need to pass the locals props in the given format:

const labels = {
  label: 'Write your comment:',
  placeholder: 'Remember, be nice!',
  submit: 'Submit'
};

Run on local

From the root

npm i && npm run start

then in another tab

cd example && npm i && npm run start

Install package

npm i --save comment-box-react

Test

To run unit tests

npm run test:unit

To run lint test:

npm run test:lint

To run all and build:

npm run test

Usage

import React from 'react';
import CommentBox from 'comment-box-react';

const themeOptions = {
  COLORS: {
    highlight: '#fff',
    background: '#faf2c7'
  }
};

const labels = {
  label: 'Write your comment man:',
  placeholder: 'Remember, be nice!',
  submit: 'Submit'
};

const App = () => {
  const submitComment = (value: string) => {
    console.log({ value });
  };
  return (
    <CommentBox
      userObjects={[
        {
          username: 'df-username',
          avatar_url:
            'https://secure.gravatar.com/avatar/f04241571d95d005e4a54f4278670718?d=mm',
          name: 'John Doe'
        }
      ]}
      labels={labels}
      onSubmit={submitComment}
      themeOptions={themeOptions}
    />
  );
};

export default App;

Theming

Set themeOptions props that will override default theme options set. themeOptions structure is consisted of:

interface ThemeProps {
  COLORS?: Object;
  TYPO?: Object;
  SPACING?: Object;
  RADIUS?: Object;
}

Each of the objects has its values that you can override:

// COLORS
const COLORS = {
  background: '#ffffff',
  highlight: '#D8DADF',
  submitButton: '#5004D9',
  fontPrimary: '#000',
  fontSecondary: 'gray',
  shadow: '#888'
};
// RADIUS
const RADIUS = {
  // ${({ theme }) => theme.RADIUS.rad*}
  rad4: '4px',
  rad6: '6px',
  rad8: '8px',
  rad25: '25px'
};
// SPACING
// Foundation of all dimensions - use to resize proprtionaly
const SPACING = {
  base: 5 // Usage -> ${({ theme }) => theme.SPACING.base * n}px
};
// TYPO

const TYPO = {
  fontFamilly: {
    primary: 'Arial, Helvetica, sans-serif'
  },
  size: {
    // ${({ theme }) => theme.TYPO.size.*}
    text5: '5px',
    text10: '10px',
    text12: '12px',
    text14: '14px',
    text16: '16px'
  },
  weight: {
    // ${({ theme }) => theme.TYPO.weight.*}
    light: 300,
    normal: 400,
    semiBold: 600,
    bold: 700,
    extraBold: 800,
    black: 900
  },
  transform: {
    // ${({ theme }) => theme.TYPO.transform.*}
    lowerCase: 'lowercase',
    none: 'none',
    upperCase: 'uppercase'
  }
};

Troubleshooting

If the example app displays an error:

####### Invalid Hook Call Warning

Try this:

One possible fix is to run npm link example/node_modules/react from library root (~/ui-kit).

This should make the library use the application’s React copy.

License

MIT © mr-ristic