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

@node-real/honeycomb

v1.2.0

Published

<p align="center"><img src="docs/logo.svg" alt="Honeycomb" /></p>

Downloads

11

Readme

Honeycomb is a collection of reusable UI components based on React and styled-components.

Getting started

Install this library as a dependency with yarn add @nodereal/honeycomb and start using our components.

Make sure you choose a theme with <HoneycombThemeProvider /> in your app before using any Honeycomb components.

import React from 'react';
import { HoneycombThemeProvider, Button } from '@nodereal/honeycomb';

export const MyApp = () => {
  return (
    <HoneycombThemeProvider family="gold" defaultVariant="light">
      <h1>My cool app</h1>
      <Button variant="primary">Click here!</Button>
    </HoneycombThemeProvider>
  );
};

You can use the props defaultVariant or variant. If you use variant, you will force Honeycomb to use exactly the choice you want. If use defaultVariant, Honeycomb will always try to first guess what the user's light/dark settings are.

You may use the optional localTheme prop to merge your own theme with the Honeycomb one. Do not try to add or overwrite stuff inside the { honeycomb } property, though.

TypeScript integration

To get a perfect integration with TypeScript when writing your styles, you can create a declaration file as shown below.

// DefaultTheme.d.ts
import 'styled-components';
import { HoneycombThemeType } from '@nodereal/honeycomb';

import { YourOwnTheme } from './your-own-theme';

declare module 'styled-components' {
  type ThemeType = HoneycombThemeType & typeof YourOwnTheme;
  export interface DefaultTheme extends ThemeType {}
}

Customizing components

We export the inner pieces that our components are composed of as static properties. You can use those to easily customize internal parts of those components.

For example, in the code below we use TextInput.Label and TextInput.Input to overwrite TextInput's internal styles.

import React from 'react';
import styled from 'styled-components';
import { TextInput } from '@nodereal/honeycomb';

const CustomTextInput = styled(TextInput)`
  ${TextInput.Label} {
    color: #f8bbd0;
  }

  ${TextInput.Input} {
    background: #e8f5e9;
    color: #64b5f6;

    ::placeholder {
      color: #7e57c2;
    }
  }
`;

export const MyComponent = () => (
  <CustomTextInput placeholder="Some placeholder…" label="A label" />
);

Testing

You may use the prop data-testid for testing. The components in this library will automatically assign data-testids to their inner components using the value you passed as a prefix.

For example, <Checkbox data-testid="MyCheckbox" label="A value" /> would render something like the following:

<input data-testid="MyCheckbox.native-input" id="…" type="checkbox" class="…" value="false" />
<label data-testid="MyCheckbox.label" for="…" class="…">
  <span data-testid="MyCheckbox.label-content" class="…">A value</span>
</label>

Contributing

  1. Clone this repo.
  2. yarn
  3. yarn dev

Adding new icons

Monochromatic SVG files can be added under src/components/Icon/assets, but there are a few things to make sure of.

  • The SVG file is monochromatic.
  • You have removed all fill="" attributes from the SVG code.
  • The SVG viewport is a square (e.g. viewBox="0 0 16 16") and the icon is centered both horizontally and vertically in it.
  • The SVG file is named with pascal casing (e.g. CaretDown.svg).
  • The SVG file is named with appropriate suffixes, in the correct order (e.g. Tick.svg, TickCircle.svg, TickCircleSolid.svg).
    1. Circle if the icon is circled.
    2. Solid if the icon has a solid fill.
    3. Color if the icon cannot change its colour.
  • The SVG file does not contain any font loading, styles or non-vector images.

Once the SVG file has been added, it must be loaded and exported in both src/components/Icon/components.tsx and src/components/Icon/urls.tsx with exactly the same name as the SVG file.