1.0.2 • Published 6 years ago

react-eazy-card v1.0.2

Weekly downloads
1
License
MIT
Repository
-
Last release
6 years ago

react-eazy-card

Travis npm package Coveralls

A React component card that eliminates the distortion of images and allows for the flexibility of card features.

Installation

npm install --save react-eazy-card

Usage

Demo

import { Card, CardHeader, CardImage, CardBody, CardFooter } from 'react-eazy-card';

class Demo extends Component {
  render() {
    return (
      <div>
        <Card>
          <CardHeader>
            <h2>Ab-Soul</h2>
          </CardHeader>
          <CardImage imageSrc="https://s3.amazonaws.com/hiphopdx-production/2013/11/Ab_Soul_304x304.jpg" />
          <CardBody>
            <p>
              Herbert Anthony Stevens IV is an American hip hop recording artist from Carson, California.
            </p>
          </CardBody>
          <CardFooter>
            <h3>Top Dawg Entertainment</h3>
          </CardFooter>
        </Card>
      </div>
    );
  }
}

<Card>

PropertyTypeDescription
childrenFunctionUser must nest all components inside <Card> component
bgColorStringUser can change the default background color
fontColorStringUser can change the default font color
styleObjectUser can add additional styles or overwrite the default ones

<CardHeader>

PropertyTypeDescription
childrenFunctionUser can render child elements inside <CardHeader> component
styleObjectUser can add additional styles or override the default ones

<CardImage>

PropertyTypeDescription
imageSrcStringUser can pass the image url to render inside <CardImage> component
styleObjectUser can add additional styles or override the default ones

<CardBody>

PropertyTypeDescription
childrenFunctionUser can render child elements inside <CardBody> component
styleObjectUser can add additional styles or override the default ones

<CardFooter>

PropertyTypeDescription
childrenFunctionUser can render child elements inside <CardFooter> component
styleObjectUser can add additional styles or override the default ones

Examples

Card w/ Additional Styles

Additional Styles

class Demo extends Component {
  render() {
    return (
      <div>
        <Card bgColor={'#000'} fontColor={'#fff'}>
          <CardHeader>
            <h2>Ab-Soul</h2>
          </CardHeader>
          <CardImage imageSrc="https://s3.amazonaws.com/hiphopdx-production/2013/11/Ab_Soul_304x304.jpg" />
          <CardBody>
            <p>
              Herbert Anthony Stevens IV is an American hip hop recording artist from Carson, California.
            </p>
          </CardBody>
          <CardFooter>
            <h3>Top Dawg Entertainment</h3>
          </CardFooter>
        </Card>
      </div>
    );
  }
}

Card w/o Header Component

No Header

class Demo extends Component {
  render() {
    return (
      <div>
        <Card>
          <CardImage imageSrc="https://s3.amazonaws.com/hiphopdx-production/2013/11/Ab_Soul_304x304.jpg" />
          <CardBody>
            <p>
              Herbert Anthony Stevens IV is an American hip hop recording artist from Carson, California.
            </p>
          </CardBody>
          <CardFooter>
            <h3>Top Dawg Entertainment</h3>
          </CardFooter>
        </Card>
      </div>
    );
  }
}

Card w/o Body Component

No Body

class Demo extends Component {
  render() {
    return (
      <div>
        <Card>
          <CardHeader>
            <h2>Ab-Soul</h2>
          </CardHeader>
          <CardImage imageSrc="https://s3.amazonaws.com/hiphopdx-production/2013/11/Ab_Soul_304x304.jpg" />
          <CardFooter>
            <h3>Top Dawg Entertainment</h3>
          </CardFooter>
        </Card>
      </div>
    );
  }
}

Card w/o Footer Component

No Footer

class Demo extends Component {
  render() {
    return (
      <div>
        <Card>
          <CardHeader>
            <h2>Ab-Soul</h2>
          </CardHeader>
          <CardImage imageSrc="https://s3.amazonaws.com/hiphopdx-production/2013/11/Ab_Soul_304x304.jpg" />
          <CardBody>
            <p>
              Herbert Anthony Stevens IV is an American hip hop recording artist from Carson, California.
            </p>
          </CardBody>
        </Card>
      </div>
    );
  }
}

License

MIT License

Copyright (c) 2018 Sahil Mehta

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago