srishjaiz / fusionbook

Develop and test FusionCharts components in isolation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FusionBook

Develop and test FusionCharts components in isolation

API

import FusionBook, { Story } from 'fusionbook';
import SmartRendererParser from 'fusionbook/smart-renderer.js';
import HTMLParser from 'fusionbook/html.js';
import LegendItem from './legend-item.js';

// Instill the ability to understand SmartRenderer components to FusionBook
FusionBook.registerParser(SmartRendererParser);
FusionBook.registerParser(HTMLParser);

// Creates a story named "Legend Item"
const legendItemStory = new Story('Legend Item');

// Adds a "with defaults" chapter to the story
legendItemStory.addChapter(
  'with defaults',
  story => story.attachChild(LegendItem)
);

// Adds a "with background" chapter to the story
legendItemStory.addChapter(
  'with background',
  story => story.attachChild(LegendItem).configure({ showBackground: true })
);

// Creates a story named "Div Element"
const divStory = new Story('Div Element');

// Adds a "with 50% opacity" chapter to the story
divStory.addChapter(
  'with 50% opacity',
  story => {
    const divElement = document.createElement('div');

    divElement.style.opacity = 0.5;

    story.appendChild(divElement);
  }
);

// export the created stories
export default [legendItemStory, divStory];

CLI

# Starts a server at localhost:3000 with the stories in the given folder
fusionbook --load "path/to/main/stories/file.js"

About

Develop and test FusionCharts components in isolation

License:MIT License


Languages

Language:JavaScript 81.9%Language:TypeScript 15.1%Language:CSS 2.2%Language:HTML 0.8%