From 39a624ce02fc3e0fc20ca16e7d8d3a9792de6aa6 Mon Sep 17 00:00:00 2001 From: Maksym Mykhailenko Date: Sat, 16 Feb 2019 11:28:03 +0800 Subject: [PATCH 1/5] winning submission from challenge 30083737 - Topcoder Connect - Wizard redesign - Controls new design + fix to format prices with comma --- components/Formsy/CheckboxGroup.jsx | 13 ++++++++++--- components/Formsy/RadioGroup.jsx | 27 +++++++++++++++++++++++++-- components/Formsy/format.js | 12 ++++++++++++ 3 files changed, 47 insertions(+), 5 deletions(-) create mode 100644 components/Formsy/format.js diff --git a/components/Formsy/CheckboxGroup.jsx b/components/Formsy/CheckboxGroup.jsx index d1ec0890f..e21e1d4c3 100644 --- a/components/Formsy/CheckboxGroup.jsx +++ b/components/Formsy/CheckboxGroup.jsx @@ -1,6 +1,7 @@ import React, { Component, PropTypes } from 'react' import { HOC as hoc } from 'formsy-react' import cn from 'classnames' +import { numberWithCommas } from './format' class CheckboxGroup extends Component { @@ -21,7 +22,7 @@ class CheckboxGroup extends Component { } render() { - const { label, name, options, layout } = this.props + const { label, name, options, layout, wrapperClass } = this.props const hasError = !this.props.isPristine() && !this.props.isValid() const disabled = this.props.isFormDisabled() || this.props.disabled const errorMessage = this.props.getErrorMessage() || this.props.validationError @@ -30,7 +31,7 @@ class CheckboxGroup extends Component { const curValue = this.props.getValue() || [] const checked = curValue.indexOf(cb.value) !== -1 const disabled = this.props.isFormDisabled() || cb.disabled || this.props.disabled - const rClass = cn('checkbox-group-item', { disabled }) + const rClass = cn('checkbox-group-item', { disabled, selected: checked }) const id = name+'-opt-'+key const setRef = (c) => this['element-' + key] = c return ( @@ -48,10 +49,16 @@ class CheckboxGroup extends Component {