(props)
| 6 | } from 'reactstrap'; |
| 7 | |
| 8 | const InputGroupAddon = (props) => { |
| 9 | const { children, ...otherProps } = props; |
| 10 | const childArr = React.Children.toArray(children); |
| 11 | const isFa = _.some(childArr, (child) => |
| 12 | React.isValidElement(child) && child.props.className && _.includes(child.props.className, 'fa')); |
| 13 | const isCheckRadio = _.some(childArr, (child) => |
| 14 | React.isValidElement(child) && (child.props.type === 'radio' || child.props.type === 'checkbox')); |
| 15 | |
| 16 | let child = isFa || isCheckRadio ? ( |
| 17 | <div className="input-group-text"> |
| 18 | { children } |
| 19 | </div> |
| 20 | ) : children; |
| 21 | |
| 22 | return ( |
| 23 | <BsInputGroupAddon { ...otherProps }> |
| 24 | { child } |
| 25 | </BsInputGroupAddon> |
| 26 | ); |
| 27 | } |
| 28 | InputGroupAddon.propTypes = { |
| 29 | ...BsInputGroupAddon.propTypes |
| 30 | }; |
nothing calls this directly
no outgoing calls
no test coverage detected