Code Monkey home page Code Monkey logo

react-ui-cards's Introduction

react-ui-cards CI

Various stylish card components for React. Focused on being ready to use with little modifications. Supply your data and you're good to go.

Live demo

https://nukeop.github.io/react-ui-cards

npm

https://www.npmjs.com/package/react-ui-cards

Installation and usage example

Minified and gzipped bundle size: 52kb.

$ npm install --save react-ui-cards
import { UserCard } from 'react-ui-cards';

export const Example = () => <UserCard
    float
    href='https://github.com/nukeop'
    header='https://i.imgur.com/vRAtM3i.jpg'
    avatar='https://i.imgur.com/XJxqvsU.jpg'
    name='Frank Hepsfield'
    positionName='Software Engineering Manager'
/>

Development

Getting started

After cloning the repo, run the following commands to start Storybook in development mode with hot reload:

$ npm install
$ npm run storybook

Running tests

The repo is configured so that it generates snapshot tests from Storybook stories. To run them, use:

$ npm test

Contributing

All contributions are welcome. You can either add something to existing cards, or create a completely new card type.

Card types

In addition to what's listed for each card type, all cards can take the following additional props:

  • className to apply additional classes to the card
  • float (boolean) to enable animation on hover
  • Other props are passed down to the enclosing div element so you can e.g. add custom callbacks for onClick and other events.

User cards

Cards representing users or people.

attribute type description
href string/null optional url the card will link to when clicked
header string url to the image that will be displayed in the upper part of the card
avatar string url to the image that will be displayed in the center of the card
name string user's name
positionName string user's role
stats array/null an optional array of objects with attributes 'name' and 'value' - this is displayed in the card's footer

User card

Product cards

Cards representing products available for purchase.

attribute type description
photos array array of urls to photos of the product
price string the price that will be displayed in the upper lefthand corner
productName string name of the product
description string a short description of the product
rating integer rating of the product (0-5). Not implemented yet.
url string url the button will link to
buttonText string/null optional button text

Product card

Tagged content cards

Cards showcasing any content that can be described with a single thumbnail and a list of tags.

attribute type description
href string/null optional url the card will link to when clicked
thumbnail string url to the image that will be displayed in the center part of the card and as the background
title string title of the card
description string short description of the content, try to not exceed one line
tags array/null an array of strings that will be converted to pill-style tags and displayed in the lower righthand corner of the card

Tagged content card

Flipping card

A card with a front and back side. Flips over on hover. Any React component can be displayed on either side.

This card is a bit different than the other ones - it has no attributes. To define it, you have to create a nested structure and pass your content as children:

    <FlippingCard>
        <FlippingCardBack>
  		  Content that will be displayed on the back of the card
  	  </FlippingCardBack>
  	  <FlippingCardFront>
  		  Content that will be displayed on the front of the card
  	  </FlippingCardFront>
  </FlippingCard>

See demo page for an example in action.

Recipe card

Cards you can use to show dishes' names, time they take to cook and how big the portions are. Heart sign can be used as "Add to favorite" button.

attribute type description
href string/null optional url the card will link to when clicked
thumbnail string url to the image that will be displayed at the top of other elements
title string name of the dish
time string amount of time it will take to prepare the dish
servings string estimation of portions' size

Recipe card

News header card

Cards you can use on the news site, shows the title, author and date it was published. Click on image to see the exact news.

attribute type description
href string/null optional url the card will link to when clicked
thumbnail string url to the image that will be displayed in the background
author string author of aricle linked in href
date string date of publishing
tags string optional. array of string to be rendered as tags

News header card

Cryptocurrency card

Cards that show cryptocurrency-related data, including a chart. Can be used for showing other data, such as fiat currency or stock market prices.

attribute type description
currencyName string Name of the cryptocurrency
currencyPrice string Current price, displayed as provided, which means you have to format it yourself
icon node Icon representing the currency, it's displayed at 24x24 px
currencyShortName string Symbol such as BTC, ETH, etc
trend string Recent price change. Just as with the price, no formatting is performed
trendDirection integer(-1, 0, 1) Indicates whether the trend is positive, negative, or if there's no change
chartColor string Color of the line on the chart
chartData array[integer] An array of integer values to be displayed on the chart

Cryptocurrency card

Payment card

Card that represents a credit card, a debit card, or other similar cards. Flips on hover to reveal the back.

attribute type description
background string Valid CSS background string. If not provided, a default background is used.
backgroundPattern string/null Lets you select one of the patterns to display in the background. Can be either "worldMap", "triangles", or "spiral". Null results in no pattern being displayed
issuerIcon string/element Card issuer icon. Either a link to the image with an icon, or a React element to render
number string Payment card number
date string The "valid thru" date
name string Name displayed on the card
cvv string CVV code displayed on the back of the card

Payment cards

react-ui-cards's People

Contributors

alex-polic avatar dependabot[bot] avatar fogfish avatar greenkeeper[bot] avatar ilavisharma avatar nukeop avatar riteshksingh1709 avatar rpaulucci3 avatar thebotlynoob avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

react-ui-cards's Issues

Getting Error while using the card components

I installed the package and tried to use the Product component, but I got an error:
https://i.imgur.com/im6SfJP.png

This is my code:

import React, { Component } from 'react';
import ProductCard from 'react-ui-cards';

export default class SpecialProducts extends Component {

render() {
	return (
		<div>
			<ProductCard productName="test" price="200" />
		</div>
	);
}

}

Can not install version 3.0.2 on Fedora Linux using Node 18.5.0

Using an LTS version of Node, I am unable to install newest version of the package. The error states it is the problem with node-sass package.

Full log from npm install

npm ERR! code 1
npm ERR! path /home/al-polic/projects/tbuddi-host/node_modules/node-sass
npm ERR! command failed
npm ERR! command sh -c node scripts/build.js
npm ERR! Building: /home/al-polic/.nvm/versions/node/v18.15.0/bin/node /home/al-polic/projects/tbuddi-host/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp verb cli [
npm ERR! gyp verb cli '/home/al-polic/.nvm/versions/node/v18.15.0/bin/node',
npm ERR! gyp verb cli '/home/al-polic/projects/tbuddi-host/node_modules/node-gyp/bin/node-gyp.js',
npm ERR! gyp verb cli 'rebuild',
npm ERR! gyp verb cli '--verbose',
npm ERR! gyp verb cli '--libsass_ext=',
npm ERR! gyp verb cli '--libsass_cflags=',
npm ERR! gyp verb cli '--libsass_ldflags=',
npm ERR! gyp verb cli '--libsass_library='
npm ERR! gyp verb cli ]
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | linux | x64
npm ERR! gyp verb command rebuild []
npm ERR! gyp verb command clean []
npm ERR! gyp verb clean removing "build" directory
npm ERR! gyp verb command configure []
npm ERR! gyp verb find Python Python is not set from command line or npm configuration
npm ERR! gyp verb find Python Python is not set from environment variable PYTHON
npm ERR! gyp verb find Python checking if "python3" can be used
npm ERR! gyp verb find Python - executing "python3" to get executable path
npm ERR! gyp verb find Python - executable path is "/usr/bin/python3"
npm ERR! gyp verb find Python - executing "/usr/bin/python3" to get version
npm ERR! gyp verb find Python - version is "3.11.2"
npm ERR! gyp info find Python using Python version 3.11.2 found at "/usr/bin/python3"
npm ERR! gyp verb get node dir no --target version specified, falling back to host node version: 18.15.0
npm ERR! gyp verb command install [ '18.15.0' ]
npm ERR! gyp verb install input version string "18.15.0"
npm ERR! gyp verb install installing version: 18.15.0
npm ERR! gyp verb install --ensure was passed, so won't reinstall if already installed
npm ERR! gyp verb install version is already installed, need to check "installVersion"
npm ERR! gyp verb got "installVersion" 9
npm ERR! gyp verb needs "installVersion" 9
npm ERR! gyp verb install version is good
npm ERR! gyp verb get node dir target node version installed: 18.15.0
npm ERR! gyp verb build dir attempting to create "build" dir: /home/al-polic/projects/tbuddi-host/node_modules/node-sass/build
npm ERR! gyp verb build dir "build" dir needed to be created? /home/al-polic/projects/tbuddi-host/node_modules/node-sass/build
npm ERR! gyp verb build/config.gypi creating config file
npm ERR! gyp verb build/config.gypi writing out config file: /home/al-polic/projects/tbuddi-host/node_modules/node-sass/build/config.gypi
npm ERR! (node:83343) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only.
npm ERR! (Use node --trace-deprecation ... to show where the warning was created)
npm ERR! gyp verb config.gypi checking for gypi file: /home/al-polic/projects/tbuddi-host/node_modules/node-sass/config.gypi
npm ERR! gyp verb common.gypi checking for gypi file: /home/al-polic/projects/tbuddi-host/node_modules/node-sass/common.gypi
npm ERR! gyp verb gyp gyp format was not specified; forcing "make"
npm ERR! gyp info spawn /usr/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/home/al-polic/projects/tbuddi-host/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args 'binding.gyp',
npm ERR! gyp info spawn args '-f',
npm ERR! gyp info spawn args 'make',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/home/al-polic/projects/tbuddi-host/node_modules/node-sass/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/home/al-polic/projects/tbuddi-host/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/home/al-polic/.cache/node-gyp/18.15.0/include/node/common.gypi',
npm ERR! gyp info spawn args '-Dlibrary=shared_library',
npm ERR! gyp info spawn args '-Dvisibility=default',
npm ERR! gyp info spawn args '-Dnode_root_dir=/home/al-polic/.cache/node-gyp/18.15.0',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/home/al-polic/projects/tbuddi-host/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/home/al-polic/.cache/node-gyp/18.15.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/home/al-polic/projects/tbuddi-host/node_modules/node-sass',
npm ERR! gyp info spawn args '-Dnode_engine=v8',
npm ERR! gyp info spawn args '--depth=.',
npm ERR! gyp info spawn args '--no-parallel',
npm ERR! gyp info spawn args '--generator-output',
npm ERR! gyp info spawn args 'build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! Traceback (most recent call last):
npm ERR! File "/home/al-polic/projects/tbuddi-host/node_modules/node-gyp/gyp/gyp_main.py", line 51, in
npm ERR! sys.exit(gyp.script_main())
npm ERR! ^^^^^^^^^^^^^^^^^
npm ERR! File "/home/al-polic/projects/tbuddi-host/node_modules/node-gyp/gyp/pylib/gyp/init.py", line 670, in script_main
npm ERR! return main(sys.argv[1:])
npm ERR! ^^^^^^^^^^^^^^^^^^
npm ERR! File "/home/al-polic/projects/tbuddi-host/node_modules/node-gyp/gyp/pylib/gyp/init.py", line 662, in main
npm ERR! return gyp_main(args)
npm ERR! ^^^^^^^^^^^^^^
npm ERR! File "/home/al-polic/projects/tbuddi-host/node_modules/node-gyp/gyp/pylib/gyp/init.py", line 629, in gyp_main
npm ERR! [generator, flat_list, targets, data] = Load(
npm ERR! ^^^^^
npm ERR! File "/home/al-polic/projects/tbuddi-host/node_modules/node-gyp/gyp/pylib/gyp/init.py", line 150, in Load
npm ERR! result = gyp.input.Load(
npm ERR! ^^^^^^^^^^^^^^^
npm ERR! File "/home/al-polic/projects/tbuddi-host/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 3021, in Load
npm ERR! LoadTargetBuildFile(
npm ERR! File "/home/al-polic/projects/tbuddi-host/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 411, in LoadTargetBuildFile
npm ERR! build_file_data = LoadOneBuildFile(
npm ERR! ^^^^^^^^^^^^^^^^^
npm ERR! File "/home/al-polic/projects/tbuddi-host/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 239, in LoadOneBuildFile
npm ERR! build_file_contents = open(build_file_path, "rU").read()
npm ERR! ^^^^^^^^^^^^^^^^^^^^^^^^^^^
npm ERR! ValueError: invalid mode: 'rU' while trying to load binding.gyp
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: gyp failed with exit code: 1
npm ERR! gyp ERR! stack at ChildProcess.onCpExit (/home/al-polic/projects/tbuddi-host/node_modules/node-gyp/lib/configure.js:351:16)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! gyp ERR! System Linux 6.1.18-200.fc37.x86_64
npm ERR! gyp ERR! command "/home/al-polic/.nvm/versions/node/v18.15.0/bin/node" "/home/al-polic/projects/tbuddi-host/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
npm ERR! gyp ERR! cwd /home/al-polic/projects/tbuddi-host/node_modules/node-sass
npm ERR! gyp ERR! node -v v18.15.0
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! not ok
npm ERR! Build failed with error code: 1

npm ERR! A complete log of this run can be found in:
npm ERR! /home/al-polic/.npm/_logs/2023-03-22T13_55_23_558Z-debug-0.log

I also tried to install versions 3.0.1 and 3.0.0, but that didn't work either.
Installing on Windows works for Node version 18.5.0 LTS.

Downgrading to older Node version is not an option for me unfortunately, because of the requirements of the project.
Can you please advise any potential solutions.
Thanks in advance

React Native

Is there component compatibility with Native? Which version?

Tagged Content Card - cannot remove pointer hover affect

<TaggedContentCard className="!transition-none !cursor-default !transform-none" key={project.id} thumbnail={project.thumbnail} title={project.title} description={project.subtitle} tags={project.links.map((link) => ( <a target="_blank" href={link.link}> {link.tag} </a> ))} />

I tried removing the default scale-up effect by passing in the !important to tailwind classes, it was able to remove the scale-up transition, but not the hover affect.

Action required: Greenkeeper could not be activated 🚨

🚨 You need to enable Continuous Integration on all branches of this repository. 🚨

To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because it uses your CI build statuses to figure out when to notify you about breaking changes.

Since we didn’t receive a CI status on the greenkeeper/initial branch, it’s possible that you don’t have CI set up yet. We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.

If you have already set up a CI for this repository, you might need to check how it’s configured. Make sure it is set to run on all new branches. If you don’t want it to run on absolutely every branch, you can whitelist branches starting with greenkeeper/.

Once you have installed and configured CI on this repository correctly, you’ll need to re-trigger Greenkeeper’s initial pull request. To do this, please delete the greenkeeper/initial branch in this repository, and then remove and re-add this repository to the Greenkeeper App’s white list on Github. You'll find this list on your repo or organization’s settings page, under Installed GitHub Apps.

FlippingCard not working.

The FlippingCard component was found to be not working when I tried to use it, following all instructions from the README.md file.

Add localization to 'Buy now' button as prop

Hello,

Thanks for your great work, it's been really useful.

Would it be a possibility to extend the functionality of the ProductCard, so it accepts the text to display in the 'Buy now' button as prop? Right now I'm editing the source code in the bundle and it's not that easy as passing a prop.

Thanks again for the awesome work!

Components interfere with other libraries

I'm utilizing another library (Reactstrap) for some components, however, when any card from this library is imported, it overwrites my already existing Card components css.

I believe the solution should be not to rely on global css classes, but rather be contained to the specific component, that way this library can co-exist with others.

Text contrast too low in ProductCardDescription

Currently, the text in ProductCardDescription has a color of #95A5A6. This does not meet WCAG requirements (source).

I propose changing the text color in ProductCardDescription to #2C3E50, to match the product title and for WCAG compliance (source).

How to customize cards style

Hi, thank you for this amazing library!
I'm a beginner and I'm wondering if it's possible to change the cards size and other css properties without changing the scss sources.
If it is possible is there a recommended way to do it?
Thank you.

Flipping Cards weird on Safari.

The flipping cards looks weird on Safari browser. You can check my project here on Safari and Chrome. Works amazing on every browser that I tried on, except Safari.

Can something be done? Thanks.

How to use this plugins

will you please write a readme file where and to integrate? what is the import and which components are needed to use for the display card

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.