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

@thefittingroom/shop-ui

v2.0.2

Published

the fitting room UI library

Downloads

1,243

Readme

The Fitting Room - Shop UI

Modal UI for The Fitting Room. Provides UI hooks to integrate into the parent UI.

Installation

npm i @thefittingroom/shop-ui

or

yarn @thefittingroom/shop-ui

Usage

import { initFittingRoom } from '@thefittingroom/shop-ui'

// Your brandId: Number
const shopId: number = 9001

// CSS Variable

export type TfrCssVariables = {
  // Colors
  brandColor?: string
  black?: string
  red?: string
  white?: string
  muted?: string
  dark?: string
  grey?: string
  lightGrey?: string

  // Main div stlyes
  mainBorderColor?: string
  mainBorderRadius?: string
  mainBorderWidth?: string
  mainBgColor?: string
  mainWidth?: string
  mainVPadding?: string
  mainHPadding?: string

  // Typography
  // All others will inherit fron mainFont if not set
  mainFont?: string
  titleFont?: string
  subtitleFont?: string
  rowFont?: string
  ctaFont?: string

  // Size Selector
  sizeSelectorTextColor?: string
  sizeSelectorFontSize?: string
  sizeSelectorFontWeight?: string
  sizeSelectorBgColor?: string
  sizeSelectorBgColorHover?: string
  sizeSelectorBgColorActive?: string
  sizeSelectorButtonHeight?: string
  sizeSelectorButtonActiveHeight?: string
  sizeSelectorButtonBorderColor?: string
  sizeSelectorButtonBorderWidth?: string
  sizeSelectorButtonRadius?: string
  sizeSelectorButtonShadow?: string
}

// UI Hooks
// These are used to hook into the lifecycle methods within the shop UI
const hooks: TfrHooks = {
  onLoading: () => {},
  onLoadingComplete: () => {},
  onError: (error: string) => {},
  onLogin: () => {},
  onLogout: () => {},
}

const cssVariables = {}

// the div id to contain the modal elements
const modalDivId: string = 'tfr-modal'

// The div id to contain the size recommendation UI
const sizeRecDivId: string = 'tfr-size-rec'

// initFittingRoom is an async function and must be awaited
const tfr = await initFittingRoom(shopId, modalDivId, sizeRecDivId, hooks, cssVariables, 'prod')

// on page nav to new product
tfr.setSku(sku)

// on user login to brand site or after initFittingRoom
// e.g. uuid, email address, username, internal database Id
tfr.setBrandUserId(brandUserId)

CSS variable defaults

:root {
  /* Colors */
  --tfr-brand-color: #209da7;
  --tfr-black: #000000;
  --tfr-red: #ff0000;
  --tfr-white: #ffffff;
  --tfr-muted: #a7a7a7;

  --tfr-dark: #121212;
  --tfr-grey: #878787;
  --tfr-light-grey: #dbdcdc;
  --tfr-dark-grey: #3f3f3f;

  /* Main */
  --tfr-main-border-color: rgba(18, 18, 18, 0.55);
  --tfr-main-border-radius: 0;
  --tfr-main-border-width: 1px;
  --tfr-main-bg-color: inherit;

  /* Spacing */
  --tfr-main-width: 440px;
  --tfr-main-v-padding: 14px;
  --tfr-main-h-padding: 20px;

  /* Typography */
  --tfr-main-font: inherit;
  --tfr-title-font: var(--tfr-main-font);
  --tfr-subtitle-font: var(--tfr-main-font);
  --tfr-row-font: var(--tfr-main-font);
  --tfr-cta-font: var(--tfr-main-font);

  /* Size Selector */
  --tfr-size-selector-text-color: var(--tfr-white);
  --tfr-size-selector-font-size: 14px;
  --tfr-size-selector-font-weight: 400;
  --tfr-size-selector-border-color: transparent;
  --tfr-size-selector-border-width: 0;
  --tfr-size-selector-bg-color: var(--tfr-grey);
  --tfr-size-selector-bg-color-hover: var(--tfr-dark-grey);
  --tfr-size-selector-bg-color-active: var(--tfr-dark);
  --tfr-size-selector-button-height: 35px;
  --tfr-size-selector-button-active-height: 45px;
  --tfr-size-selector-button-active-border-color: transparent;
  --tfr-size-selector-button-active-border-width: 0;
  --tfr-size-selector-button-radius: 8px;
  --tfr-size-selector-button-shadow: 0 4px 4px 0 rgba(0, 0, 0, 0.3);
}

Several low level methods are exposed via tfr.shop

See @thefittingroom/sdk