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

@mycujoo/mcls-components-card

v1.0.0-rc.11

Published

## Card components

Downloads

9

Readme

MCLS Components - Card

Card components

Cards are a set of highly configurable components that are available to be used and passed to sliders, grids or columns. Each card is meant to be better suited for a different purpose, design or event type.

Match Card

This card is intended to be used for Match-type events where there is or will be a score.

MatchCard receives data object directly from the parent slider or grid.

It requires to be passed at least dataPaths object which maps the path from the event data object to the different fields that are displayed (team names, scores, logos, event start time, id, etc). Clicking on the card may be handled through a function passed as onClick or as a <a> HTML element. href value for the card is provided through hrefBasePath. This string needs to include {id} in it, where the card id will be 'injected' automatically into it. As an example hrefPath="/events/{id}"

The basic structure of the card consists of an optional thumbnail, a body and an optional action section which can be customized through config object.

Match Card relies on MCLS Events status and will display different visual behaviours based on the current status of the event. For example, live events show scores while upcoming events display event start time, and the default styles and label for the card action buttons is different for each event status. This can be overriden through config.

import { MatchCard } from "@mycujoo/mcls-components-card";
import { Slider } from "@mycujoo/mcls-components-slider";

const dataPaths = {
  homeTeamLogo: 'metadata.home_team.logo',
  homeTeamName: 'metadata.home_team.name',
  homeTeamShortCode: 'metadata.home_team.abbreviation',
  homeTeamScore: 'metadata.home_team.score',
  awayTeamLogo: 'metadata.away_team.logo',
  awayTeamName: 'metadata.away_team.name',
  awayTeamShortCode: 'metadata.away_team.abbreviation',
  awayTeamScore: 'metadata.away_team.score',
  eventVenue: 'location.physical.venue',
  startTime: 'start_time',
  status: 'status',
  thumbnailUrl: 'thumbnail_url',
  viewers: 'viewers',
  leagueName: 'metadata.league_name',
  id: "id"
}

const card = <MatchCard
  dataPaths={dataPaths}
  onClick={handleCardClick}
  config={{
    size: 'm',
    borderRadius: '16px',
    thumbnail: {
      icon: true,
      viewers: true,
    },
    action: {
      buttonConfig: {
        position: 'left',
        text: 'Custom text',
        borderRadius: '4px',
        type: 'outlined',
      },
    },
    showSeparator: true,
    primaryColor: '#FFF',
    showTag: true,
  }}
/>

import { Slider } from '@mycujoo/mcls-components-slider';

// Example of slider usage
<Slider
    data={events}
    title={"My events"}
    config={sliderConfig}
    card={card}
    lang="en"
/>

Simple Card

This card is intended to be used for all type of events. It's less specialised and will only display custom title, subtitle, background and right side of title short label (useful for any other possible properties like duration)

It requires to be passed at least dataPaths object which maps the path from the event data object to the different fields that are displayed (team names, scores, logos, event start time, id, etc). Clicking on the card may be handled through a function passed as onClick or as a <a> HTML element. href value for the card is provided through hrefBasePath. This string needs to include {id} in it, where the card id will be 'injected' automatically into it. As an example hrefPath="/events/{id}".

import { SimpleCard } from "@mycujoo/mcls-components-card";

const dataPaths = {
    title: 'title',
    titleRight: 'durationLabel',
    thumbnailUrl: 'cover.absoluteUrl',
    subtitle: 'description',
    id: 'id',
};

const card = <SimpleCard
  dataPaths={dataPaths}
  onClick={handleCardClick}
  config={{
    size: 'm',
    openInNewWindow: true,
    textColor: '#FAF',
    bgColor: '#300'
    borderRadius: '16px',
    thumbnail: {
      icon: true,
      viewers: true,
    },
    action: {
      buttonConfig: {
        position: 'left',
        text: 'Custom text',
        borderRadius: '4px',
        type: 'outlined',
      },
    },
    showSeparator: true,
    primaryColor: '#FFF',
    showTag: true,
  }}
/>

import { Slider } from '@mycujoo/mcls-components-slider';

// Example of slider usage
<Slider
    data={events}
    title={"My events"}
    config={sliderConfig}
    card={card}
    lang="en"
/>

Card Placeholder

Preload card component useful for showing loading card state.

import { CardPlaceholder } from "@mycujoo/mcls-components-card";

<CardPlaceholder 
  size="m"
  height="100px"
  width="500px"
  bgColor="#000"
  border="1px solid #111"
  borderRadius="5px"
  boxShadow=""
  className="custom class names"
/>