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

@s-ui/react-card-composable

v1.9.0

Published

The CardComposable component features a placeholder to portray a custom primary and a secondary content. So you can set an image, slider or any media component in one and some other content in the other.

Downloads

12

Readme

CardComposable

The CardComposable component features a placeholder to portray a custom primary and a secondary content. So you can set an image, slider or any media component in one and some other content in the other.

Usage

The SUI-CardComposable allows to pass custom content in the primary placeholder and also provides a sui-CardComposable-primary class as a wrapper. This primary content is required.

Secondary content might be passed or not to SuiCardComposable component. If content is provided will be rendered inside a generic div sui-CardComposable-secondary wrapper. If no content is provided this contained will not be rendered at all.

Check out this example below


ReactDom.render(
    <SuiCardComposable className={'myCustom-class'}
      primary={
        <a href={images[0].link}><img src={images[0].src} /></a>
      }
      secondary={[
        <div>
            <h2>
              This is the Card Title
            </h2>
            <p>
              This is the description
            </p>
        </div>
      }
    />,
  document.getElementById('main')
);

Setting a custom className

The div Card wrapper has a default sui-CardComposable class. You can override it defining a custom class by setting the proptype className as follows:

ReactDom.render(
    <SuiCardComposable className={'myCustom-class'}
      primary={
        <a href={images[0].link}><img src={images[0].src} /></a>
      }
      secondary={[
        <div>
            <h2>
            This is the Card Title
            </h2>
            <p>
                This is the description
            </p>
        </div>
      }
    />,
  document.getElementById('main')
);

Card layout Orientation

The default Card orientation is portrait mode. Use the landscapeLayout={true} parameter to set it landscape where the primary placeholder aligns to the left and the secondary to the right:


ReactDom.render(
    <SuiCardComposable landscapeLayout
      primary={
        <a href={images[0].link}><img src={images[0].src} /></a>
      }
      secondary={[
        <div>
            <h2>
                This is the Card Title
            </h2>
            <p>
                This is the description
            </p>
        </div>
      }
    />,
  document.getElementById('main')
);

Content First Property

When landscapeLayout={true} you can also set secondary content placeholder rendered before primary by setting contentFirst={} to true:


ReactDom.render(
    <SuiCardComposable landscapeLayout contentFirst
      primary={
        <a href={images[0].link}><img src={images[0].src} /></a>
      }
      secondary={[
        <div>
          <h2>
          This is the Card Title
          </h2>
          <p>
          This is the description
          </p>
        </div>
      }
    />,
  document.getElementById('main')
);

Data model used in this example

Use an array of objects:

const images = [{
  src: 'https://scontent-mad1-1.cdninstagram.com/t51.2885-15/e15/11199623_633712610062793_1285693904_n.jpg',
  type: 'image',
  alt: 'Test',
  link: 'https://www.instagram.com/p/TNUdPKpMgM/?taken-by=davecarter'
}];