1egoman / funnies

:stuck_out_tongue_winking_eye: Make users laugh when your app loads.
https://1egoman.github.io/funnies/
MIT License
178 stars 54 forks source link

Travis build status Dependency Status devDependency Status

Funnies

A flexible way to add funny loading messages to webapps with optional react support.

Examples and Demo

As of funnies 1.2.0, funnies ships with examples. Take a look at https://1egoman.github.io/funnies/ or build them locally by cloning down this repository, then running npm install && gulp example. This will start up a local server on port 8080.



Usage

Javascript

import Funnies from 'funnies';
let funnies = new Funnies();
funnies.message(); // "Reticulating Splines..."
funnies.message(); // "Generating witty dialog..."
funnies.message(); // "Go ahead -- hold your breath!"

React Component

React rendering

import {FunniesComponent} from 'funnies';
ReactDOM.render(<FunniesComponent />, node);
ReactDOM.render(<FunniesComponent interval={1000} />, node); // a new message every second
ReactDOM.render(<FunniesComponent customMessages={["You're too funny", "Thinking really hard..."]} />, node); // Add a few of your own messages

React Styles

Here's some css to properly animate funnies in the react component. Totally not required!

.funnies-text {
  transition: opacity 250ms ease-in-out;
}
.funnies-text.funnies-enter {
  opacity: 0;
}
.funnies-text.funnies-enter-active {
  opacity: 0;
}
.funnies-text.funnies-leave {
  display: none;
}
.funnies-text.funnies-leave-active {
  opacity: 0;
}

jQuery

Odan wrote a great jQuery plugin for Funnies!

import $ from 'jquery';
// (include js/jquery.funnies.js)

$('element').funnies();

Troubleshooting/FAQ

Areas to improve