Skip to content

Commit

Permalink
Merge pull request #358 from suppermancool/Progressive-Registration
Browse files Browse the repository at this point in the history
Support Working Hours `isRequired`
  • Loading branch information
maxceem authored Apr 20, 2020
2 parents a2b3ea7 + 99147ac commit ec4bd76
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions components/Formsy/WorkingHoursSelection.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ class WorkingHoursSelection extends React.Component {
startHourValue,
endHourValue,
selectElement,
selectElementProps
selectElementProps,
isRequired
} = this.props

const Select = selectElement || FormsySelect
Expand All @@ -82,9 +83,11 @@ class WorkingHoursSelection extends React.Component {
name={startHourName}
onChange={this.onStartHourChange}
value={startHourValue}
required={isRequired}
{...(selectElement && selectElementProps
? selectElementProps
: {})}
validationError={`Please enter ${startHourLabel}`}
/>
</div>

Expand All @@ -96,9 +99,11 @@ class WorkingHoursSelection extends React.Component {
name={endHourName}
onChange={this.onEndHourChange}
value={endHourValue}
required={isRequired}
{...(selectElement && selectElementProps
? selectElementProps
: {})}
validationError={`Please enter ${endHourLabel}`}
/>
</div>
</div>
Expand All @@ -107,6 +112,12 @@ class WorkingHoursSelection extends React.Component {
}
}


WorkingHoursSelection.defaultProps = {
isRequired: false
}


WorkingHoursSelection.PropTypes = {
startHourLabel: PT.string.isRequired,
endHourLabel: PT.string.isRequired,
Expand All @@ -117,6 +128,7 @@ WorkingHoursSelection.PropTypes = {
startHourValue: PT.string,
endHourValue: PT.string,
selectElement: PT.element,
selectElementProps: PT.object
selectElementProps: PT.object,
isRequired: PT.bool
}
export default WorkingHoursSelection

0 comments on commit ec4bd76

Please sign in to comment.