From 9d71c93762f372689556653f44a11fb972ff899c Mon Sep 17 00:00:00 2001 From: John Munsch Date: Fri, 19 Jul 2019 21:53:44 -0500 Subject: [PATCH] Got a series of stories working for the Peity clone components. --- app/js/peity.components.js | 10 +--- stories/peity.stories.js | 113 +++++++++++++++++++++---------------- 2 files changed, 64 insertions(+), 59 deletions(-) diff --git a/app/js/peity.components.js b/app/js/peity.components.js index 2c33694..67ff7ba 100644 --- a/app/js/peity.components.js +++ b/app/js/peity.components.js @@ -251,9 +251,7 @@ class DonutElement extends PieElement { } } -// As with the pie and donut simply being to variations of the same custom -// element, there's a good chance these two will lead to only one -// implementation. +// TODO: This component is only partially implemented. I've never gone back to finish all the d3 stuff. class LineElement extends BaseElement { constructor() { super(); @@ -421,9 +419,3 @@ customElements.define('wc-pie', PieElement); customElements.define('wc-donut', DonutElement); customElements.define('wc-line', LineElement); customElements.define('wc-bar', BarElement); - -window.addEventListener('WebComponentsReady', function(e) { - // This is just testing the function the WebComponents polyfill provides. It - // gets called at the same point whether it polyfilled anything or not. - console.log('Components are ready'); -}); diff --git a/stories/peity.stories.js b/stories/peity.stories.js index 401337b..7ce2077 100644 --- a/stories/peity.stories.js +++ b/stories/peity.stories.js @@ -3,58 +3,71 @@ import { storiesOf } from '@storybook/html'; import '../app/js/peity.components'; -storiesOf('Peity', module).add( - 'heading', - () => /* html */ ` -

Interactive Example

-0.5,1,2 +storiesOf('Peity', module) + .add( + 'Pie Charts', + () => /* html */ ` +

Pie Charts

- +
+ 1/5 + 226/360 + 0.52/1.561 + 1,4 + 226,134 + 0.52,1.041 + 1,2,3,2,2 +
` + ) + .add( + 'Donut Charts', + () => /* html */ ` +

Donut Charts

-

Pie Charts

-
- 1/5 - 226/360 - 0.52/1.561 - 1,4 - 226,134 - 0.52,1.041 - 1,2,3,2,2 -
+
+ 1/5 + 226/360 + 0.52/1.561 + 1,4 + 226,134 + 0.52,1.041 + 1,2,3,2,2 +
` + ) + .add( + 'Line Charts', + () => /* html */ ` +

Line Charts

-

Donut Charts

-
- 1/5 - 226/360 - 0.52/1.561 - 1,4 - 226,134 - 0.52,1.041 - 1,2,3,2,2 -
+
+ 5,3,9,6,5,9,7,3,5,2 + 5,3,2,-1,-3,-2,2,3,5,2 + 0,-3,-6,-4,-5,-4,-7,-3,-5,-2 +
` + ) + .add( + 'Bar Charts', + () => /* html */ ` +

Bar Charts

-

Line Charts

-
- 5,3,9,6,5,9,7,3,5,2 - 5,3,2,-1,-3,-2,2,3,5,2 - 0,-3,-6,-4,-5,-4,-7,-3,-5,-2 -
+
+ 5,3,9,6,5,9,7,3,5,2 + 5,3,2,-1,-3,-2,2,3,5,2 + 0,-3,-6,-4,-5,-4,-7,-3,-5,-2 +
` + ) + .add( + 'Attributes', + () => /* html */ ` +

Attributes

-

Bar Charts

-
- 5,3,9,6,5,9,7,3,5,2 - 5,3,2,-1,-3,-2,2,3,5,2 - 0,-3,-6,-4,-5,-4,-7,-3,-5,-2 -
- -

Attributes

-
- 1/7 - 2/7 - 3/7 - 4/7 - 5/7 - 6/7 - 7/7 -
` -); +
+ 1/7 + 2/7 + 3/7 + 4/7 + 5/7 + 6/7 + 7/7 +
` + );