mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2025-02-25 05:44:13 -05:00
use radio button values in report
This commit is contained in:
parent
28a5ee47aa
commit
3a9742c77e
4 changed files with 66 additions and 50 deletions
|
@ -29,7 +29,7 @@ const Errors = keyMirror({
|
|||
|
||||
const getInitialState = () => ({
|
||||
status: Status.IDLE,
|
||||
field: Fields.TITLE,
|
||||
field: null,
|
||||
error: null,
|
||||
isOpen: false
|
||||
});
|
||||
|
|
|
@ -9,6 +9,8 @@ const StudioReportTile = props =>
|
|||
<input
|
||||
type="radio"
|
||||
name="studio-report"
|
||||
value={props.value}
|
||||
onChange={props.handleChange}
|
||||
/>
|
||||
{props.heading}
|
||||
</div>
|
||||
|
@ -32,7 +34,9 @@ const StudioReportTile = props =>
|
|||
StudioReportTile.propTypes = {
|
||||
heading: PropTypes.string,
|
||||
text: PropTypes.string,
|
||||
image: PropTypes.string
|
||||
handleChange: PropTypes.func,
|
||||
image: PropTypes.string,
|
||||
value: PropTypes.string
|
||||
};
|
||||
|
||||
export default StudioReportTile;
|
||||
|
|
|
@ -34,7 +34,9 @@ const StudioReport = ({
|
|||
handleOpen,
|
||||
handleClose,
|
||||
handleSubmit
|
||||
}) => (
|
||||
}) => {
|
||||
const handleChange = event => handleSetField(event.target.value);
|
||||
return (
|
||||
<div>
|
||||
{canReport && (
|
||||
<button onClick={handleOpen}><FormattedMessage id="general.report" /></button>
|
||||
|
@ -56,16 +58,19 @@ const StudioReport = ({
|
|||
<p><FormattedMessage id="studio.reportPleaseExplain" /></p>
|
||||
<form onSubmit={handleSubmit}>
|
||||
<StudioReportTile
|
||||
handleChange={handleChange}
|
||||
heading={intl.formatMessage({id: 'studio.title'})}
|
||||
text={title}
|
||||
value={Fields.TITLE}
|
||||
/>
|
||||
<StudioReportTile
|
||||
handleChange={handleChange}
|
||||
heading={intl.formatMessage({id: 'studio.description'})}
|
||||
text={description}
|
||||
value={Fields.DESCRIPTION}
|
||||
/>
|
||||
<StudioReportTile
|
||||
handleChange={handleChange}
|
||||
heading={intl.formatMessage({id: 'studio.thumbnail'})}
|
||||
image={image}
|
||||
value={Fields.THUMBNAIL}
|
||||
|
@ -73,8 +78,11 @@ const StudioReport = ({
|
|||
<p><FormattedMessage id="studio.reportAreThereComments" /></p>
|
||||
<button
|
||||
className="button"
|
||||
type="submit"
|
||||
disabled={field === null || isSubmitting}
|
||||
>
|
||||
<FormattedMessage id="report.send" />
|
||||
{isSubmitting && <FormattedMessage id="report.sending" />}
|
||||
{!isSubmitting && <FormattedMessage id="report.send" />}
|
||||
</button>
|
||||
</form>
|
||||
</ModalInnerContent>
|
||||
|
@ -82,7 +90,7 @@ const StudioReport = ({
|
|||
)}
|
||||
</div>
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
StudioReport.propTypes = {
|
||||
canReport: PropTypes.bool,
|
||||
|
|
|
@ -75,6 +75,10 @@ $radius: 8px;
|
|||
padding: 2rem;
|
||||
}
|
||||
|
||||
.button:disabled {
|
||||
background-color: $active-dark-gray;
|
||||
}
|
||||
|
||||
.studio-report-tile {
|
||||
background: $ui-light-gray;
|
||||
width: 200px;
|
||||
|
|
Loading…
Reference in a new issue