File: src/stories/Arc.js

Recommend this page to a friend!
  Classes of Manolo Salsas   React JS SVG Library   src/stories/Arc.js   Download  
File: src/stories/Arc.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,399 bytes
 

Contents

Class file image Download
import React from 'react'; import { storiesOf, action } from '@storybook/react'; import Arc from '../Arc'; storiesOf('Arc', module) .add('orange 270º, 80px radius, butt stroke linecap', () => { const props = { radius: 80, degreesOffset: 0, degrees: 270, strokeWidth: 20, strokeColor: 'orange', fillColor: 'none', strokeLinecap: 'butt' }; return renderArc(props); }) .add('yellow 70º, 100px radius, 50º offset, round stroke linecap', () => { const props = { radius: 100, degreesOffset: 50, degrees: 70, strokeWidth: 10, strokeColor: 'yellow', fillColor: 'none', strokeLinecap: 'round' }; return renderArc(props); }) .add('red circle', () => { const props = { radius: 50, degreesOffset: 0, degrees: 360, strokeWidth: 1, strokeColor: 'red', fillColor: 'red' }; return renderArc(props); }) .add('without options', () => { const props = {}; return renderArc(props); }); function renderArc(props) { return ( <div className="svg-wrapper" style={{ background: 'gray' }}> <Arc {...props} /> </div> ); }