File: src/stories/Line.js

Recommend this page to a friend!
  Classes of Manolo Salsas   React JS SVG Library   src/stories/Line.js   Download  
File: src/stories/Line.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: Add strokeLinecap prop to Arc and Line. Update stories and README. Refactor code.
Date: 2 years ago
Size: 1,536 bytes
 

Contents

Class file image Download
import React from 'react'; import { storiesOf, action } from '@storybook/react'; import Line from '../Line'; storiesOf('Line', module) .add('orange 100px length, 45º, butt stroke linecap', () => { const props = { lineLength: 100, degrees: 45, strokeWidth: 10, strokeColor: 'orange', strokeLinecap: 'butt' }; return renderLine(props); }) .add('yellow 50px length, 120º, round stroke linecap', () => { const props = { lineLength: 50, degrees: 120, strokeWidth: 10, strokeColor: 'yellow', strokeLinecap: 'round' }; return renderLine(props); }) .add('red 80px length, 290º, square stroke linecap', () => { const props = { lineLength: 80, degrees: 290, strokeWidth: 10, strokeColor: 'red', strokeLinecap: 'square' }; return renderLine(props); }) .add('green 130px length, 350º', () => { const props = { lineLength: 130, degrees: 350, strokeWidth: 3, strokeColor: 'green' }; return renderLine(props); }) .add('without options', () => { const props = {}; return renderLine(props); }); function renderLine(props) { return ( <div className="svg-wrapper" style={{ background: 'gray' }}> <Line {...props} /> </div> ); }