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

@halfhelix/wantable-headless

v0.0.95

Published

React Component Library for Wantable

Downloads

211

Readme

Wantable Headless Components

NPM version

Technologies

Rollup

The components are processed and bundled by rollup. There is a script defined in the package.json file that runs the rollup -c command. This command uses the configuration set within the rollup.config.js file located in the root of the project repository.

TypeScript / React

The components are bundled with their respective type definition files index.d.ts. This allows the component user to use TypeScript if they so choose. Additionally, defining typed props within the components enforces the component prop requirements at development. The TypeScript definition settings are configured within tsconfig.json then bundled within the package using the settings configured in rollup.config.js.

TailwindCSS

The wantable-headless repository does not bundle any css within the packaged components. That said, TailwindCSS classes are present in the jsx of each component which allows their styles to be processed by the hh-wantable-theme Shopify Theme repository. All the TailwindCSS processing configuration is placed in the hh-wantable-theme repository's tailwind.config.js file.

Directories

  • ./src - the main src directory for this component library
  • ./src/components - the component folder will house all the component folders
  • ./src/components/[ComponentName] - the respective component folders where each component will be housed, please use CapitalizedCamel case for the naming convention for these folders

Getting Started

  1. Start by installing all the dependencies within this repository
yarn
# or
npm i
  1. Once installed, you can start building out the components within their respective folders ./src/components/[ComponentName]

Building Components

1. Create a component directory

Create a directory within ./src/components using CapitalizedCamel case in the naming convention. For example: ./src/components/ExampleComponent

cd ./src & mkdir ExampleComponent

2. Create an index.ts file

Create an index.ts file inside the folder you've created. Within the file, export default and target the component folder.

export { default } from './ExampleComponent'

3. Create a corresponding component .tsx file

In the same folder, create a .tsx file of the same name as the directory. For example: ./src/components/ExampleComponent/ExampleComponent.tsx

Inside the new TypeScript file, create the functionality and logic for your component.

import React from "react";

// Declare types for your props
interface ExampleComponentProps {
    class: string;
    label: string;
}

const ExampleComponent = (props: ExampleComponentProps) => {
    // Ensure to use all props you've declared
    return <button className={props.class}>{props.label}</button>;
}

// Export the component appropriately using the same naming convention
export default ExampleComponent;

Connect your NPM account

For documentation on how to connect your npm account with the repository, please read: Half Helix - Wantable / Technical Documentation / wantable-headless / Connect your NPM Account

Governance

Please do not update or modify the following files:

  • rollup.config.js - configuration file for rollup, used to bundle the component appropriately
  • tsconfig.json - configuration file for TypeScript, this contains logic for parsing types and bundling type declarations with the compiled component code