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

react-placards

v1.0.2

Published

A component inspired from stripe's placards

Downloads

14

Readme

React Placards

Installation

  yarn add react-placards

Getting Started

A default height and width is given to the component but is required to render the component: Refer


  import React from 'react';
  import { Placards } from 'react-placards'
  import {CustomComponents} from '../somepath/CustomComponentLibrary.js'
  function App() {
    const items = [
      {
        id: "content-types",
        content: "You can pass in a plain text string.",
      },
      {
        id: "custom-components",
        content: <CustomComponents
          heading="Custom Components"
          date="31-01-2021"
          description={"OR you can create your own custom components"}
          {...extraProps}
        />
      }, ...];
    return (
      <div className="App">
        <Placards
          items={items}
        />
      </div>
    );
  }
  export default App;

Props

| name | description | required | default | | --------------- | ----------------------------------------------------------------------------- | -------- | ------------------------------------------------------------- | | items | collection of Item Type | true | [] | | width | width of the component | false | 200 | | height | height of the component | false | 200 | | timing | delay between card switch | false | 5000 | | cardStyles | style definitions for Top Card Style Props | false | check Top Card Style Props | | stackCardStyles | style definitions for Stacked Cards Style Props | false | check Stacked Cards Style Props | | containerStyles | style definitions for Container Style Props | false | check Container Style Props |

Item Type

| name | description | required | type | | ------- | -------------------------------------------- | -------- | ------------------------------ | | id | unique key for each component being rendered | true | string | | content | content that renders inside the cards | true | string or custom Component |

items = [
  {
    id: 'unique-id',
    content: <MyCustomComponent {...props} />
  },
  {
    id: 'unique-id-2',
    content: 'Text content'
  }
];

Top Card Style Props

Use the props below to change the styles of top card.

Note: Top card's styles will be applied to all the item's content

For more control on styles, reset the default styles and create your own Custom Card component

| name | description | required | default | | --------------- | ---------------------------------------------- | -------- | ------------------------------------------------------------------ | | backgroundColor | background-color applied to top card | false | #ffffff | | borderRadius | border-radius applied to ALL sides of top card | false | 0px | | boxShadow | box-shadow behind top card | false | 0 15px 35px rgba(50, 50, 93, 0.1),0 5px 15px rgba(0, 0, 0, 0.07) | | padding | padding applied to top card | false | 0px |

cardStyles = {
  backgroundColor: 'red',
  borderRadius: '4px',
  boxShadow: '0 10px 30px black',
  padding: '10px'
};

Stacked Card Style Props

| name | description | required | default | | ----------- | --------------------------------------- | -------- | --------- | | secondColor | background-color applied to second card | false | #f0f0f0 | | thirdColor | background-color applied to third card | false | #fafafa |

stackCardStyles = {
  secondColor: 'red',
  thirdColor: 'yellow'
};

Container Style Props

use these to place your cards inside the container

| name | description | required | default | | -------- | ------------------------- | -------- | ------- | | height | height of the container | false | 200px | | width | width of the container | false | 200px | | overflow | overflow of the container | false | hidden | | padding | padding of the container | false | 5% |

stackCardStyles = {
  height: 200,
  width: 200,
  overflow: 'hidden',
  padding: '5%'
};

Passing custom height/width

By default height & width have been set to 200px. Overide them by passing custom values.

<Placards items={items} width="400" height="400" />

Passing custom timing

By default timing has been set to 5000ms. Overide it by passing custom timing.

<Placards items={items} timing="7000" />

Passing custom styling for Card

Override cardStyles by passing custom styles

<Placards
  items={items}
  cardStyles={{
    padding: '10px',
    borderRadius: '4px',
    ...moreProperties
  }}
/>

Change second and third card's background

Override background colors of second and third cards

<Placards
  items={items}
  stackCardStyles={{
    secondColor: 'red',
    thirdColor: 'yellow'
  }}
/>

Meta

Inspired from Stripe's Announcement Banners. (Sadly has been removed now :'( )

Distributed under the MIT license. See LICENSE for more information.