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

@coopdigital/coop-frontend-components

v0.1.2

Published

Components contains styles for using the Co-op components from the design system

Downloads

14

Readme

Co-op front-end components

All components are dependant on the foundations base styles.

Using the components

Components and their usage are documented in the design system pattern library.

Building components

All components are name spaced with:

.coop-c-[name]

We build our components based on the BEM style. This combination of name spacing and BEM allows us to build flexible components that can be shared across the Co-op easily - avoiding clashing styles or the need to create complex overrides when developing services.

If you are building a component for the design system you would name space your component with coop-c-[name].

When developing components for specific services choose a sensible namespace for your service. For example funeral care components would be named fc-c-.

For example the card component:

/* ===============================================
Cards - Co-op components
=============================================== */

.coop-c-card {
  @include spacing('margin', 'bottom', 'base');
}

.coop-c-card__content {
  padding: 12px;
  color: $text;
  background: $page;
  box-shadow: 0 5px 0 0 rgba(0, 0, 0, 0.05);

  > :last-child {
    margin-bottom: 0;
    padding-bottom: 0;
  }

  @include media(medium) {
    padding: 24px;
  }
}

.coop-c-card__image {
  display: block;
  width: 100%;
}

// Only apply the content offset if an image is present
.coop-c-card__image + .coop-c-card__content {
  position: relative;
  z-index: 101;
  margin: -32px $eighth-spacing-unit 0 0;

  @include media(small) {
    margin-right: $quarter-spacing-unit;
  }

  @include media(medium) {
    margin: -50px $half-spacing-unit 0 0;
  }
}

.coop-c-card__title {
  color: $text;
}

.coop-c-card-heading {
  position: absolute;
  top: -20px;
  left: 20px;
  z-index: 110;
  display: block;
  background: $page;
  font-family: $medium;
  font-size: em-calc(16px);
  padding: 8px 12px;

  @include media(medium) {
    top: -24px;
    left: 40px;
    padding: 8px 12px;
    font-size: em-calc(20px);
  }

  @include media(large) {
    top: -35px;
    padding: 18px 24px;
  }
}

.coop-c-card-heading__link {
  display: block;
  color: $text;
  text-decoration: underline;
  border-bottom: 0;
}

.coop-c-card-heading__link:hover {
  color: $text;
  text-decoration: none;
}

// Some styles are only applied if the card is a link
.coop-c-card__link {
  display: block;
  border-bottom: 0;

  .coop-c-card__title {
    text-decoration: underline;
  }

  .coop-c-card__content {
    &:hover {
      .coop-c-card__title {
        text-decoration: none;
      }
    }
  }
}

@mixin cardBackground($link, $backgroundColour) {
  background-color: $backgroundColour;
  box-shadow: none;

  a {
    color: $link;
    border-color: $link;
  }
}

.coop-c-card__content--background {
  @include cardBackground($text, $yellow-mid);
}

Extending components

If you use a global component but want to change it's styling, use extra classes to extend it. For example if you wanted to centre align the text in card, you would add a modifier class (as per BEM) to change the alignment. This SCSS would be written within a cards.scss file in your project - do not directly edit the component SCSS unless you are amending styles to be included within the design system. Note that the override class uses the name space from the fictional funeral care service built on top of the base components.

.fc-c-card__content--centre {
  text-align: center;
}