hasError prop was added
This commit is contained in:
parent
49edd01154
commit
b0def70285
@ -18,6 +18,8 @@ const TimeInput = styled.div`
|
|||||||
|
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
||||||
|
border-color: ${(props) => (props.hasError ? "#f21c0e" : "#d0d5da")};
|
||||||
|
|
||||||
:focus {
|
:focus {
|
||||||
border-color: #4781d1;
|
border-color: #4781d1;
|
||||||
}
|
}
|
||||||
@ -31,7 +33,7 @@ const TimeInput = styled.div`
|
|||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
export const TimePicker = ({ date, setDate, onChange, className }) => {
|
export const TimePicker = ({ date, setDate, onChange, className, hasError }) => {
|
||||||
const hoursInputRef = useRef(null);
|
const hoursInputRef = useRef(null);
|
||||||
const minutesInputRef = useRef(null);
|
const minutesInputRef = useRef(null);
|
||||||
const timeInputRef = useRef(null);
|
const timeInputRef = useRef(null);
|
||||||
@ -117,7 +119,11 @@ export const TimePicker = ({ date, setDate, onChange, className }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TimeInput ref={timeInputRef} onClick={focusHoursInput} className={className}>
|
<TimeInput
|
||||||
|
ref={timeInputRef}
|
||||||
|
onClick={focusHoursInput}
|
||||||
|
className={className}
|
||||||
|
hasError={hasError}>
|
||||||
<TextInput
|
<TextInput
|
||||||
withBorder={false}
|
withBorder={false}
|
||||||
forwardedRef={hoursInputRef}
|
forwardedRef={hoursInputRef}
|
||||||
@ -145,6 +151,7 @@ TimePicker.propTypes = {
|
|||||||
|
|
||||||
/** Allow you to handle changing events of component */
|
/** Allow you to handle changing events of component */
|
||||||
onChange: PropTypes.func,
|
onChange: PropTypes.func,
|
||||||
|
hasError: PropTypes.bool,
|
||||||
};
|
};
|
||||||
|
|
||||||
TimePicker.defaultProps = {
|
TimePicker.defaultProps = {
|
||||||
@ -152,4 +159,5 @@ TimePicker.defaultProps = {
|
|||||||
setDate: () => {},
|
setDate: () => {},
|
||||||
onChange: () => {},
|
onChange: () => {},
|
||||||
className: "",
|
className: "",
|
||||||
|
hasError: false,
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user