@mooretodd/survey
Advanced tools
Comparing version 0.1.6 to 2.0.0
@@ -10,3 +10,3 @@ import React from 'react'; | ||
const twoDecimalPlaces = num => num.toFixed(20).slice(0,-18); | ||
const twoDecimalPlaces = num => num.toFixed(20).slice(0, -18); | ||
@@ -44,3 +44,3 @@ const Description = React.createClass({ | ||
</tr> | ||
) | ||
); | ||
} | ||
@@ -47,0 +47,0 @@ }); |
import survey from './survey/Survey.react'; | ||
export const Survey = survey; | ||
{ | ||
"name": "@mooretodd/survey", | ||
"version": "0.1.6", | ||
"version": "2.0.0", | ||
"description": "", | ||
@@ -9,8 +9,8 @@ "main": "index.js", | ||
"dependencies": { | ||
"@mooretodd/heading": "^0.1.5", | ||
"@mooretodd/loader": "^0.1.5", | ||
"@mooretodd/services": "^0.1.5", | ||
"@mooretodd/survey_result_detail": "^0.1.5", | ||
"@mooretodd/utils": "^0.1.5" | ||
"@mooretodd/heading": "^2.0.0", | ||
"@mooretodd/loader": "^2.0.0", | ||
"@mooretodd/services": "^2.0.0", | ||
"@mooretodd/survey_result_detail": "^2.0.0", | ||
"@mooretodd/utils": "^2.0.0" | ||
} | ||
} |
import React from 'react'; | ||
import d3 from "d3"; | ||
import d3 from 'd3'; | ||
import styles from './style.css'; | ||
@@ -18,7 +18,7 @@ import R from 'ramda'; | ||
const getValue = (rating, key) => parseInt(rating[key]) || 0; | ||
const getValue = (rating, key) => parseInt(rating[key], 0) || 0; | ||
const parseRating = rating => Object.assign({ | ||
positive: getValue(rating, '4') + getValue(rating, '5'), | ||
negative: getValue(rating, '1') + getValue(rating, '2'), | ||
negative: getValue(rating, '1') + getValue(rating, '2') | ||
}); | ||
@@ -28,4 +28,4 @@ | ||
name: key, | ||
value: key === 'negative' ? | ||
(R.prop(key, rating) || 0) * -1 : R.prop(key, rating) || 0 | ||
value: key === 'negative' ? | ||
(R.prop(key, rating) || 0) * -1 : R.prop(key, rating) || 0 | ||
}); | ||
@@ -56,3 +56,3 @@ | ||
if (this.props.rating) { | ||
this.draw(); | ||
this.draw(); | ||
} | ||
@@ -81,3 +81,3 @@ }, | ||
.scale(x) | ||
.orient("bottom"); | ||
.orient('bottom'); | ||
@@ -87,13 +87,13 @@ x.domain(d3.extent(data, d => d.value)).nice(); | ||
svg.selectAll(".bar") | ||
svg.selectAll('.bar') | ||
.data(data) | ||
.enter().append("rect") | ||
.attr("class", d => d.value < 0 ? styles.negative : styles.positive) | ||
.attr("x", d => x(Math.min(0, d.value))) | ||
.attr("width", d => Math.abs(x(d.value) - x(0))) | ||
.attr("height", height); | ||
.enter().append('rect') | ||
.attr('class', d => d.value < 0 ? styles.negative : styles.positive) | ||
.attr('x', d => x(Math.min(0, d.value))) | ||
.attr('width', d => Math.abs(x(d.value) - x(0))) | ||
.attr('height', height); | ||
svg.append("g") | ||
.attr("class", "x axis") | ||
.attr("transform", "translate(0," + height + ")") | ||
svg.append('g') | ||
.attr('class', 'x axis') | ||
.attr('transform', 'translate(0,' + height + ')') | ||
.call(xAxis); | ||
@@ -111,3 +111,3 @@ | ||
render() { | ||
return <div ref="d3" className={styles.rating}></div>; | ||
return (<div ref="d3" className={styles.rating} />); | ||
} | ||
@@ -117,4 +117,1 @@ }); | ||
export default Rating; | ||
import React from 'react'; | ||
import uuid from 'node-uuid'; | ||
import R from 'ramda'; | ||
@@ -28,3 +27,3 @@ import styles from './style.css'; | ||
getInitialState(){ | ||
getInitialState() { | ||
return { | ||
@@ -34,3 +33,3 @@ themes: [], | ||
loading: true | ||
} | ||
}; | ||
}, | ||
@@ -63,3 +62,3 @@ | ||
descriptions={descriptions(result)} | ||
ratings={ratings(result)}/>) | ||
ratings={ratings(result)} />); | ||
}, | ||
@@ -102,2 +101,2 @@ | ||
export default Survey; | ||
export default Survey; |
@@ -5,4 +5,2 @@ import React from 'react'; | ||
import R from 'ramda'; | ||
import classNames from 'classnames/bind'; | ||
import Heading from '@mooretodd/heading'; | ||
import styles from './style.css'; | ||
@@ -12,4 +10,6 @@ | ||
propTypes: { | ||
descriptions: React.PropTypes.arrayOf(React.PropTypes.object).isRequired, // not ideal; | ||
ratings: React.PropTypes.object.isRequired, // not ideal; | ||
descriptions: React.PropTypes.arrayOf(React.PropTypes.object).isRequired, | ||
// not ideal ^; | ||
ratings: React.PropTypes.object.isRequired, | ||
// not ideal ^; | ||
title: React.PropTypes.string.isRequired, | ||
@@ -22,3 +22,3 @@ total: React.PropTypes.number.isRequired | ||
active: false | ||
} | ||
}; | ||
}, | ||
@@ -30,3 +30,3 @@ | ||
ratings: {} | ||
} | ||
}; | ||
}, | ||
@@ -43,3 +43,3 @@ | ||
label={label} | ||
rating={rating}/>); | ||
rating={rating} />); | ||
}, | ||
@@ -63,3 +63,3 @@ | ||
<tbody> | ||
{descriptions.map(this.renderDescription)} | ||
{descriptions.map(this.renderDescription)} | ||
</tbody> | ||
@@ -73,6 +73,6 @@ <caption className={styles.caption}> | ||
</li> | ||
) | ||
); | ||
} | ||
}); | ||
export default Theme; | ||
export default Theme; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
394
1
13125
+ Added@mooretodd/heading@2.0.2(transitive)
+ Added@mooretodd/loader@2.0.2(transitive)
+ Added@mooretodd/services@2.0.2(transitive)
+ Added@mooretodd/survey_result_detail@2.0.2(transitive)
+ Added@mooretodd/utils@2.0.2(transitive)
- Removed@mooretodd/heading@0.1.5(transitive)
- Removed@mooretodd/loader@0.1.5(transitive)
- Removed@mooretodd/services@0.1.5(transitive)
- Removed@mooretodd/survey_result_detail@0.1.5(transitive)
- Removed@mooretodd/utils@0.1.5(transitive)
Updated@mooretodd/heading@^2.0.0
Updated@mooretodd/loader@^2.0.0
Updated@mooretodd/services@^2.0.0
Updated@mooretodd/utils@^2.0.0