1.0.1 • Published 5 years ago

react-polaroid v1.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

react-polaroid

React polaroid component - card

NPM License: MIT Coverage: lines Coverage: functions Downloads Build

Install

yarn add react-polaroid

Tests

CI by Travis-CI

Testing done by Jest, Sinon, Enzyme, react-test-renderer

yarn test

Or

yarn test --watch

Generate coverage report

yarn test-coverage

Usage

import React, { Component } from "react";

import Polaroid from "react-polaroid";

export default class App extends Component {
  constructor(props) {
    super(props);

    this.state = {
      flip: false
    };
  }
  flip = () => {
    this.setState({
      flip: !this.state.flip
    });
  };

  render() {
    return (
      <div>
        <Polaroid
          frontText="Polaroid kitty - front with default flip"
          rotation={0}
          flip={this.state.flip}
          onClick={() => this.flip()}
        />
      </div>
    );
  }
}

Polaroid (component)

Demo

https://matejturay.github.io/react-polaroid/

Test Coverage

You can find detailed report in ./coverage folder

File% Stmts% Branch% Funcs% LinesUncovered Lines
All files10094.44100100
index.js10094.4410010071

Props

NameTypeDefaultDescriptionRequired
frontTextstringPolaroid kitty - frontText on the back of the polaroidno
backTextstringPolaroid kitty - backText on the back of the polaroidno
cardColorstringwhiteOptional background color propno
widthnumber220Width of componentno
heightnumber400Height of componentno
disabledboolfalseDisable flippingno
flipboolfalseControl flipping between front and backno
styleobject{}Style to customize the component wrapperno
imgSrcstringplacecat.jpgImage urino
typeenumdefaultAnimation type (side or default)no
rotationnumber0Rotation of the componentno

License

MIT © MatejTuray