Giter VIP home page Giter VIP logo

react-wordcloud-demo's Introduction

react-wordcloud-demo

Build Status Dependencies devDependencies

NOTE: This component is not published. It is just for demonstration purposes.

Premise

  • The component should be usable within an existing application. No routing needed.
  • The data is already available. No fetching mechanism needed.
  • The component should be distributable as commonjs, umd and es6-module.

Jump to the example!

Installation

Be sure to use the latest version of node.js and npm. Note: Currently the component is not published via npm.

  1. Install: npm i --save react-wordcloud
  2. Install peerDependencies that are listed in package.json.

Usage / Props

To run the component with the default props, it is enough to include the WordCloud component with some topics:

  <WordCloud
    topics={topics}
  />

WordCloud inherits the components Cloud and Sidebar. If you want to be more flexible it is possible to load that components individually:

import {
  WordCloud,
  Cloud,
  Sidebar
} from `react-wordcloud`
...
  render() {
    <Cloud
      fontName={"Impact"}
      fontSizes={[13, 16, 20, 26, 35, 49]}
      height={500}
      onSelectTopic={() => console.log('Topic selected!')}
      topics={topics}
      width={500}
    />
  }
...  

WordCloud

Prop Default Type Description
fontName Sans-Serif string Fontname used for the Cloud component
fontSizes [13, 16, 20, 26, 35, 49] int[] Available fontsizes for the Cloud component
height 400 int Height of component
topics [] object[] Content of topics.json
width 400 int Width of component

Cloud

Prop Default Type Description
fontName - string Fontname used for the Cloud component
fontSizes - int[] Available fontsizes for the Cloud component
height - int Height of component
onSelectTopic - function Eventhandler
selectedTopic - object Selected item object
topics - object[] Content of topics.json
width - int Width of component

Sidebar

Prop Default Type Description
topic null object Topic object

Development

To develop the component it is recommend to use the example.

  1. Install dependencies
  • npm i
  • cd example
  • npm i
  1. Start webpack-dev-server inside /example, which uses the sources if available: npm start
  2. Open browser: http://localhost:8080/webpack-dev-server/

Structure

  • /components:

    • Individual components with isolated markup
    • Could contain each other
    • Rarely have their own state. Better to write as functional components
  • /utils:

    • Functions which are used by some components
    • Could easily be tested

Dependencies

Have a look at the package.json.

Test

  1. Install dependencies: npm i
  2. Run tests: npm test

Example

To run the example, open http://purii.github.io/react-wordcloud-demo/ or follow these steps:

  1. Install dependencies
  • npm i
  • cd example
  • npm i
  1. Start webpack-dev-server inside /example, which uses the sources if available: npm start
  2. Open browser: http://localhost:8080/

Publish

  1. Install dependencies: npm i
  2. Build bundles for umd, commonjs and es6-module: npm run bundle
  3. The css file will be located in /dist/wordcloud.min.css
  4. Note the peerDependencies

react-wordcloud-demo's People

Contributors

purii avatar

Watchers

 avatar  avatar

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.