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 🙏

© 2026 – Pkg Stats / Ryan Hefner

merch_components

v2.4.7

Published

default library for merchOS Labs project

Downloads

16

Readme

merch_components

Welcome to merch components a component library for building web-stores

simplistic use for a simplistic app..

Components


Basic Usage Container Header Item Navigation Carousel Image Button Button Group Link Bar Placeholder Footer


import React, { useState } from 'react';
import logo from './logo.svg';
import './App.css';
import { Item, Container } from 'merch_components'
import {data} from './__mock/data'  // ?? or.. 

function App() {
  const [items, setItems] = useState(data);
  
  const styleOverrides = {
    wrapperStyle:{
      width:'100%',
      {...}
    },
    {...}
  }
  handleClick = (e) =>{
    // e.preventDefault() is called by default inside the components...
    clickLogic(...)
  }
  handleChange = (e) =>{
    // e.preventDefault() is called by default inside the components...
    changeLogic(...)
  }
  return (
    <div className="App">
      <Container>
        {/* as you can see all you have to do is pass in the data shape style and cbs */}
        {items && items.map((item, i)=>(<Item item={item} style={styleOverrides} onClickCallback={handleClick} onChangeCallback={handleChange}/>))}
      </Container>
    </div>
  );
}

export default App;

Container

The Container is used mostly for wrapping multiple components.. there are exceptions.. the <Button/> component for instance would be wrapped inside a <ButtonGroup/>..

{...}
import{ Container }from 'merch_components';

const Component = () => {
  {...}
  return (
    <Container>{..wraps most components}</Container>
  )
}

CSS AVALABLE TO OVERRIDE none... sorry..


Header

the <Header/> is a static component that doesn't move it takes in a title, a path to a logo and any style overrides. it comes stock with, a search bar and a cart component.

{...}
import{Header}from 'merch_components';

const Component = () => {
  {...}
  return (
    <Header title='title of store' logoSrc='url-or-path/to/src' style={...anyOverridingStyles}/>
  )
}

CSS AVALABLE TO OVERRIDE padding, -> padding border, -> border width, -> width border-radius, -> borderRadius background-color, -> backgroundColor color -> color


Item

the <Item/> is by far the most complex pre built component. it acceptes an object {} for an item that will build an item based on the information you pass in. for instance an item thats on sale will have a sale flag on the top of it while an item that does not. simply doesnt.. all items accept an image inside the object. if the image isnt found however if one isn't found then the placeholder will show in the place of any image.. all text areas on the item are able to be swapped with an input to take in user input and change the item on the fly from the 'builder' the onClickCallback and onChangeCallback respectivly utalize their in built onChange and onClick events.. just have to pass in the method you want to do.

{ 
  "id" : 0,
  "itemName": "Item",
  "itemCost": 0.00,
  "imageSrc": "src/to/item-image",
  "saleCost": 0.00,
  "onSale":   false,
  "onClickCallback",
  "onChangeCallback",
}

^^^ the object structure for the item itself vvv how to use an Item

import {Container, Item}from 'merch_components';

const Component = ()=>{
  
  const [data, setData] = ({...^})
  const style = {
    ...someStyles
    }
  
  handleClick = (e) =>{
    // add something ?? delete something.. your choice.. your app
    setData({...})
  }
  handleChange = (e) =>{
    // update something ?? 
    setData({...})
  }
  return (
    <Container>
      <Item item={data} style={style} onClickCallback={handleClick} onChangeCallback={handleChange}/>
    </Container>
  )
}

CSS AVALABLE TO OVERRIDE padding, -> padding border, -> border width, -> width border-radius, -> borderRadius background-color, -> backgroundColor color -> color


Navigation

{ "links": "[]" }
{...}
import{Navigation}from 'merch_components';

const Component = () => {
 {...}  
 return (
   <Navigation buttons={[buttons1, button2]} style={...anyOverridingStyles}/>
 )
}

where buttons is an array of button objects with { id, name, url }


CSS AVALABLE TO OVERRIDE padding, -> padding border, -> border width, -> width border-radius, -> borderRadius background-color, -> backgroundColor color -> color


Carousel

  { 
    "images": "[]" 
  }
  import { Container, Carousel } from 'merch_components'

  const imgs = [...img, ...img, ...img]
  
  const App = () => {
    return (
      <Container>
        <Carousel images={...imgs}/>
      </Container>
    )

  }

where images is an array of images.. will cycle


CSS AVALABLE TO OVERRIDE padding, -> padding border, -> border width, -> width border-radius, -> borderRadius background-color, -> backgroundColor color -> color


Image

{
   "size": "[medium, small, none]",
   "src": "src to image", 
}
  import { Container, Carousel } from 'merch_components'

  const path = '../'
  
  const App = () => {
    return (
        <Image size={'medium'} src={path} />
    )

  }

will result in 3 different sized images aspect ratio scaled accordingly


CSS AVALABLE TO OVERRIDE none... sorry..


Button

{...}
import{Button, ButtonGroup}from 'merch_components';

const Component = () => {
  {...}
  return (
    <ButtonGroup>
    {...}
       <Button name='name-of-button' style={...optionalStyles} onClickCallback={()=>{...}} />
    </ButtonGroup>
  )
}

name => the text that is displayed on the button style => any optional styles to override the object, acceptes an object { } onClickCallback => what you want to happen when this item is called.


CSS AVALABLE TO OVERRIDE padding, -> padding border, -> border width, -> width border-radius, -> borderRadius background-color, -> backgroundColor color -> color


Button Group

{...}
import{Button, ButtonGroup}from 'merch_components';

const Component = () => {
  {...}
  return (
    <ButtonGroup>
    {...}
    <Button />
    </ButtonGroup>
  )
}

CSS AVALABLE TO OVERRIDE none... sorry..


Link Bar

{...}
import{Linkbar}from 'merch_components';
const links = ['facebook', 'twitter']
const Component = () => {
  {...}
  return (
    <Linkbar links={...links} />
  )
}

CSS AVALABLE TO OVERRIDE padding, -> padding border, -> border width, -> width border-radius, -> borderRadius background-color, -> backgroundColor color -> color


Placeholder

{...}
import{ Placeholder }from 'merch_components';
const Component = () => {
  {...}
  return (
    <Placeholder type={'item'} />
  )
}

CSS AVALABLE TO OVERRIDE padding, -> padding border, -> border width, -> width border-radius, -> borderRadius background-color, -> backgroundColor color -> color


Footer

{ "buttons": "[]" }
{...}
import{ Footer }from 'merch_components';

const Component = () => {
 {...}  
 return (
   <Footer buttons={[ {...button1 }, {...button2 } ]} style={{...anyOverridingStyles}}/>
 )
}

CSS AVALABLE TO OVERRIDE padding, -> padding border, -> border width, -> width border-radius, -> borderRadius background-color, -> backgroundColor color -> color