diff --git a/package.json b/package.json index 143b05f6e..951a6e528 100644 --- a/package.json +++ b/package.json @@ -29,10 +29,12 @@ "express-http-proxy": "1.1.0", "lodash.defaults": "4.0.1", "newrelic": "1.25.4", - "raven": "0.10.0" + "raven": "0.10.0", + "scratch-gui": "0.1.0-prerelease.20180529181946" }, "devDependencies": { "ajv": "6.4.0", + "approximate-number": "2.0.0", "async": "1.5.2", "autoprefixer": "6.3.6", "babel-cli": "6.26.0", @@ -95,7 +97,6 @@ "redux-thunk": "2.0.1", "sass-lint": "1.5.1", "sass-loader": "6.0.6", - "scratch-gui": "0.1.0-prerelease.20180522203439", "scratchr2_translations": "git://github.com/LLK/scratchr2_translations.git#master", "slick-carousel": "1.6.0", "source-map-support": "0.3.2", diff --git a/src/_colors.scss b/src/_colors.scss index f1fcf7fa5..2e7bd838b 100644 --- a/src/_colors.scss +++ b/src/_colors.scss @@ -18,9 +18,11 @@ $ui-border: hsla(0, 0, 85, 1); //#D9D9D9 /* 3.0 colors */ /* Using www naming convention for now, should be consistent with gui */ -$ui-green: hsla(163, 83, 40, 1); //#0fbd8c Pen Primary -$ui-coral: hsla(350, 100, 70, 1); //#FF6680 More Priamry +$ui-green: hsla(163, 83, 40, 1); // #0fbd8c Pen Primary +$ui-coral: hsla(350, 100, 70, 1); // #FF6680 More Primary +$ui-coral-dark: hsla(350, 100, 60, 1); // #FF3355 More tertiary $ui-blue-10percent: hsla(215, 100, 65, .1); +$ui-blue-25percent: hsla(215, 100, 65, .25); $ui-orange-25percent: hsla(35, 90, 55, .25); /* Overlay UI Gray Colors */ diff --git a/src/components/forms/inplace-input.scss b/src/components/forms/inplace-input.scss index 46deab4b9..33bc254b3 100644 --- a/src/components/forms/inplace-input.scss +++ b/src/components/forms/inplace-input.scss @@ -3,16 +3,18 @@ .inplace-input { transition: all .5s ease; - border: 2px dashed $ui-dark-gray; - border-radius: 5px; + border: 2px dashed $ui-blue-25percent; + border-radius: 8px; background-color: transparent; padding: 0 1rem; + width: calc(100% - 2.25rem); color: $type-gray; &:focus { transition: all .5s ease; outline: none; - border: 1px solid $ui-blue; + border: 2px solid $ui-blue; + box-shadow: 0 0 0 4px $ui-blue-25percent; } &.fail { @@ -27,31 +29,41 @@ &::-ms-reveal, &::-ms-clear { display: none; } + + &::placeholder { + font-style: italic; + } } .inplace-textarea { transition: all 1s ease; - margin-bottom: .75rem; - border: 2px dashed $ui-dark-gray; - border-radius: 5px; + border: 2px dashed $ui-blue-25percent; + border-radius: 8px; background-color: $ui-light-gray; padding: .75rem 1rem; - width: calc(100% - 2.25rem); - min-height: 20rem; + width: 100%; line-height: 1.75em; color: $type-gray; - font-size: .875rem; + font-size: 1rem; + box-sizing: border-box; resize: none; &:focus { transition: all 1s ease; outline: none; - border: 1px solid $ui-blue; + border: 2px solid $ui-blue; + box-shadow: 0 0 0 4px $ui-blue-25percent; } &.fail { border: 1px solid $ui-orange; } + + &::placeholder { + padding-top: 1rem; + text-align: center; + font-style: italic; + } } diff --git a/src/components/forms/textarea.scss b/src/components/forms/textarea.scss index d1782d37f..69556f361 100644 --- a/src/components/forms/textarea.scss +++ b/src/components/forms/textarea.scss @@ -22,4 +22,8 @@ &.fail { border: 1px solid $ui-orange; } + + &::placeholder { + font-style: italic; + } } diff --git a/src/components/modal/report/modal.jsx b/src/components/modal/report/modal.jsx new file mode 100644 index 000000000..c6419d4f5 --- /dev/null +++ b/src/components/modal/report/modal.jsx @@ -0,0 +1,186 @@ +const bindAll = require('lodash.bindall'); +const PropTypes = require('prop-types'); +const React = require('react'); +const FormattedMessage = require('react-intl').FormattedMessage; +const injectIntl = require('react-intl').injectIntl; +const intlShape = require('react-intl').intlShape; +const Modal = require('../base/modal.jsx'); +const log = require('../../../lib/log.js'); + +const Form = require('../../forms/form.jsx'); +const Button = require('../../forms/button.jsx'); +const Select = require('../../forms/select.jsx'); +const Spinner = require('../../spinner/spinner.jsx'); +const TextArea = require('../../forms/textarea.jsx'); + +require('../../forms/button.scss'); +require('./modal.scss'); + +class ReportModal extends React.Component { + constructor (props) { + super(props); + bindAll(this, [ + 'handleReasonSelect', + 'handleSubmit' + ]); + this.state = { + prompt: props.intl.formatMessage({id: 'report.promptPlaceholder'}), + reason: '', + waiting: false + }; + } + handleReasonSelect (name, value) { + const prompts = [ + this.props.intl.formatMessage({id: 'report.promptCopy'}), + this.props.intl.formatMessage({id: 'report.promptUncredited'}), + this.props.intl.formatMessage({id: 'report.promptScary'}), + this.props.intl.formatMessage({id: 'report.promptLanguage'}), + this.props.intl.formatMessage({id: 'report.promptMusic'}), + this.props.intl.formatMessage({id: 'report.promptPersonal'}), + this.props.intl.formatMessage({id: 'report.promptGuidelines'}), + 'not used', + this.props.intl.formatMessage({id: 'report.promptImage'}) + ]; + this.setState({prompt: prompts[value], reason: value}); + } + handleSubmit (formData) { + this.setState({waiting: true}); + this.props.onReport(formData, err => { + if (err) log.error(err); + this.setState({ + prompt: this.props.intl.formatMessage({id: 'report.promptPlaceholder'}), + reason: '', + waiting: false + }); + }); + } + render () { + const { + intl, + onReport, // eslint-disable-line no-unused-vars + type, + ...modalProps + } = this.props; + const contentLabel = intl.formatMessage({id: `report.${type}`}); + return ( + +
+
+
+ {contentLabel} +
+
+ +
+ + + + ) + }} + /> +
+