Git Product home page Git Product logo

react-pulser's Introduction

React-Pulser

Description

React component which displays an animated frequency graph. Adds a nice touch to audio playback UI's.

  • npm install --save react-pulser
import React, { Component } from 'react';
import Pulser from "react-pulser";
import "./index.css";

export default class App extends Component {
    constructor(props) {
        super(props);
        this.state = {
            playing: false
        }
        this.handleClick = this.handleClick.bind(this);
    }
    handleClick(e) {
        this.setState(prevState => {
            return {
                playing: !prevState.playing
            }
        })
    }
    render() {
        let { playing } = this.state
        return (
            <div className="app-wrapper">
                <button onClick={this.handleClick} >Play/Pause</button>
                <Pulser animate={playing} ></Pulser>
            </div>
        )
    }
}

react-pulser demo

  • NOTE: The <Pulser> component fills its parent container by default. Make sure it has a specified height and has position set to relative or it may not display. See the Props section below for more information on how to use custom styling.

Props:

Name Type Default Description
animate boolean false Toggles bar graph animation.
pulserStyles object {} Style object for the outer container. Use this if you want to override the default CSS styling. You can also refer to the selector .pulser-wrapper in CSS.
barStyles object {} Style object for individual bars. Use this if you want to override the default CSS styling. You can also refer to the selector .bar in CSS.
options object {} The options prop is an object which contains several extra configuration settings. See below.
Options prop
let options = {
    barQuant: 7,
    minHeight: 15,
    changeRate: 5
}
<Pulser animate options={options}>
Name Type Default Description
barQuant number 5 Specifies number of bars to display.
minHeight number 30 Specifies the minimum initial height of each bar in terms of the percentage of its parent container. Must be between 0 and 30.
changeRate number 15 Specifies the number in milliseconds for how fast to animate.

react-pulser's People

Contributors

bbgrabbag avatar

Stargazers

Justin Stahlman avatar

Forkers

jeffcoh23

react-pulser's Issues

Does not build due to the css import

I followed the same demo you did and built a simple React component like yours. Everything builds fine except if I add import './index.css'. If I comment out that line it builds fine and I can publish to npm and import into a project.

I saw that your module imports index.css next to the index.js, just as I am trying to do. You added and the relevant css-loader files to package.json and webpack.config.js. I did everything as you did but when I when I run npm run build and then import the module in a project I get these errors:

./src/sd-react-loading/build/index.js
  Line 1377:  Unexpected '!' in '!!../node_modules/css-loader/index.js!./styles.css'. Do not use import syntax to configure webpack loaders  import/no-webpack-loader-syntax
  Line 1568:  'DEBUG' is not defined                                                                                                         no-undef

So I cloned your repo to see how you got it to work, but I also get a build error with your repo:

./src/react-pulser/build/index.js
  Line 228:  'DEBUG' is not defined                                                                                                           no-undef
  Line 685:  Unexpected '!' in '!!../node_modules/css-loader/index.js!./index.css'. Do not use import syntax to configure webpack loaders     import/no-webpack-loader-syntax
  Line 879:  Unexpected '!' in '!!../../node_modules/css-loader/index.js!./index.css'. Do not use import syntax to configure webpack loaders  import/no-webpack-loader-syntax

Does it look like I am missing something? Can you get a fresh clone of your project to build?

Webpack in dependencies or devDependencies?

In package.json, does webpack need to be in dependencies or can it be in devDependencies? When I npm install the published package I see it installs webpack. I don’t think a project needs this because whole point is we are accessing the build, right?

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.