All files / ts/components/forms input-group-addon.tsx

100% Statements 13/13
100% Branches 2/2
100% Functions 2/2
100% Lines 11/11
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 3520x 20x 20x               20x 20x 12x 12x 4x             4x                   20x   20x  
import * as classNames from 'classnames';
import * as React from 'react';
import { HTMLProps, PureComponent } from 'react';
import { ComponentProps } from '../../types';
 
export type InputGroupAddonProps = ComponentProps & HTMLProps<HTMLElement>;
 
/**
 * Used to display additional context within an `InputGroup`.
 */
export class InputGroupAddon extends PureComponent<InputGroupAddonProps, {}> {
  public render () {
    const {
      children,
      className,
      width,
      style,
      component: Component = 'div',
      ...remainingProps
    } = this.props;
 
    return (
      <Component
        {...remainingProps}
        className={classNames('input-group-addon', className)}
        style={{width, ...style}}
      >
        {children}
      </Component>
    );
  }
}
 
export default InputGroupAddon;