File: src/stories/Rectangle.js

Recommend this page to a friend!
  Classes of Manolo Salsas   React JS SVG Library   src/stories/Rectangle.js   Download  
File: src/stories/Rectangle.js
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: React JS SVG Library
Generate animated graphics in SVG using React JS
Author: By
Last change: Update of src/stories/Rectangle.js
Date: 2 years ago
Size: 1,267 bytes
 

Contents

Class file image Download
import React from 'react'; import { storiesOf, action } from '@storybook/react'; import Rectangle from '../Rectangle'; storiesOf('Rectangle', module) .add('orange 100x200px, no fill color', () => { const props = { width: 100, height: 200, strokeWidth: 5, strokeColor: 'orange', fillColor: 'none' }; return renderRectangle(props); }) .add('yellow 200x100px, orange fill color', () => { const props = { width: 200, height: 100, strokeWidth: 5, strokeColor: 'yellow', fillColor: 'orange' }; return renderRectangle(props); }) .add('red 100x100px, no fill color', () => { const props = { width: 100, height: 100, strokeWidth: 5, strokeColor: 'red', fillColor: 'none' }; return renderRectangle(props); }) .add('without options', () => { const props = {}; return renderRectangle(props); }); function renderRectangle(props) { return ( <div className="svg-wrapper" style={{ background: 'gray' }}> <Rectangle {...props} /> </div> ); }