Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@fractal-components/random-gif-pair

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fractal-components/random-gif-pair

A sample UI component built using `fractal-component`

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
12
increased by300%
Maintainers
1
Weekly downloads
 
Created
Source

A Sample RandomGifPair UI Component

Overview

This is a sample UI Component built using fractal-component to demonstrate its reusability.

Quick Start

To try it out, simply create a HTML file with the following content (also available on CodePen):

<!doctype html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>RandomGifPair Demo</title>
    <!--
        Load `babel-standalone` to support JSX in script tag
    -->
    <script src="https://unpkg.com/babel-standalone@7.0.0-beta.3/babel.min.js"></script>
    <script src="https://unpkg.com/react@16.5.0/umd/react.production.min.js"></script>
    <script src="https://unpkg.com/prop-types@15.6.2/prop-types.min.js"></script>
    <script src="https://unpkg.com/react-dom@16.5.0/umd/react-dom.production.min.js"></script>
    <script src="https://unpkg.com/redux-saga@1.0.0-beta.2/dist/redux-saga.min.umd.js"></script>
    <script src="https://unpkg.com/fractal-component@latest/dist/fractal-component.min.umd.js"></script>
    <script src="https://unpkg.com/jss@9.8.7/dist/jss.min.js"></script>
    <script src="https://unpkg.com/jss-preset-default@4.5.0/dist/jss-preset-default.min.js"></script>
    <script src="https://unpkg.com/@fractal-components/random-gif@latest/dist/@fractal-components/random-gif.umd.js"></script>
    <script src="https://unpkg.com/@fractal-components/random-gif-pair@latest/dist/@fractal-components/random-gif-pair.umd.js"></script>
  </head>
  <body>

    <div id="app_root"></div>
    <script type="text/babel">
    FractalComponent.AppContainerUtils.createAppContainer({
        //--- make dev tool always available
        reduxDevToolsDevOnly: false
    });
    ReactDOM.render(<RandomGifPair.default />, document.getElementById("app_root"));
    </script>
  </body>
</html>

You can also use it as ES6 module:

import "@babel/polyfill";

import React from "react";
import ReactDOM from "react-dom";

import { AppContainerUtils } from "fractal-component";
import RandomGifPair, { actions, actionTypes} from "@fractal-components/random-gif-pair";

AppContainerUtils.createAppContainer({
    reduxDevToolsDevOnly: false
});

ReactDOM.render(<RandomGifPair />, document.getElementById("root"));

API / Interface

Component Properties

  • apiKey: Giphy.com API key. If not set, default one will be used
  • showButton: Boolean. Whether a click button should be shown. You will want to hide the button when you reuse this component to create a new component. e.g. RandomGifPairPair
  • styles: Can used to replace the built-in styling. Accepts JSS styling object

Action Interface

Outgoing Actions
  • NEW_GIF: Send out when a new gif url has been retrieved from Giphy.com
  • LOADING_START: Send out when loading is started
  • LOADING_COMPLETE: Send out when loading is completed
Outgoing Actions
  • REQUEST_NEW_PAIR: Will attempt to get a pair of random Gifs from Giphy.com when receive this action

Giphy.com API key

This comes with a testing Giphy.com API key in order to retrieve random Gifs from https://giphy.com/. The api key is limted to 40 requests per hour.

You can create your own API key from https://developers.giphy.com/ and set the API key by api property. e.g.

<RandomPair apiKey="xxxxxxxx" />

Keywords

FAQs

Package last updated on 11 Sep 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc