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

@code-like-a-carpenter/components

v8.0.0

Published

A collection of components I can use accross projects

Downloads

386

Readme

Components (@code-like-a-carpenter/components)

license standard-readme compliant npm (scoped) npm Dependabot badge semantic-release

A collection of components I can use accross projects

This is not a styleguide and this is not a design system. I've been finding I keep writing the same components across many projects (Button, Card, Alert, etc). While each of these components should be styled according to its project, I shouldn't need to write the typescript more than once. This project serves to unify the typescript design of my UI components across many projects.

Table of Contents

Install

npm install @code-like-a-carpenter/components

Dependencies

This project assumes you're using Bootstrap 5.3 or later. While it does have a dependency as such, depending on how you're importing Bootstrap, you may or may not get the right version if you've separate installed it.

You must import Bootstrap in a way that's compatible with your build process; due to all the different ways you may have chosen to bundle styles, this library cannot import Bootstrap for you.

Usage

See storybook for full documentation

Import the components into your project.

import {Card} from '@code-like-a-carpenter/components';

Styles

Import the styles into your project. package.json contains keys for both sass and css.

For higher-level tools, you should be able to import this module directly:

@import '@code-like-a-carpenter/components'

If you're using the sass CLI, there are a few quirks that might make importing a bit more difficult. First, the CLI doesn't deal with node modules, so you'll need to specify both --load-path node_modules as well as the full path to the file to import. You'll also need to import the sass source rather than the built css because @import does not inline files ending in .css (it assume those should be imported as a css import at runtime rather than a sass import at compile time).

@import '@code-like-a-carpenter/components/src/style.scss'

Note that you'll separately need to import bootstrap styles using whatever technique makes the most sense for your build process. There are many ways to customize Bootstrap, too numerous to discuss here.

Customizing Styles

This library only recently started export styles and so they'll likely evolve. Styles are still considered unstable so breaking changes will not constitute a major version bump.

Originally, the plan had been to avoid exporting styles at all and leave styling to the consumer. Unfortunately, even simple components often needs some set of styles to reach their baseline functionality.

As styles evolve, expect the following:

  • You'll use CSS variables to control built-in behaviors of components that might work one of several ways (i.e., if you find you need to add or remove class names from a component dynamically, that's probably a bug)
  • For behaviors that can't yet be controlled by CSS variables (because container style queries aren't a thing yet), the component will accept props that add/remove class names for you.
  • You'll override classes in your stylesheets to customize aesthetics.
  • Components will leverage Bootstrap variables whenever possible and so should update with the rest of your theme.

Maintainer

Ian Remmel

Contribute

PRs Welcome

License

MIT © Ian Remmel, LLC 2020 until at least now