File size: 897 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
// @flow

import * as React from "react";
import Form from "../components/Form/Form.react";
import Button from "../components/Button/Button.react";
import type { Props as FormProps } from "../components/Form/Form.react";
import type { Props as FormInputProps } from "../components/Form/FormInput.react";
import type { Props as ButtonProps } from "../components/Button/Button.react";

type Props = {|
  formProps?: FormProps,
  inputProps?: FormInputProps,
  buttonProps?: ButtonProps,
|};

/**
 * A form containing a single input field with an appended Button
 */
function FormWithSingleInputAndButton({
  formProps,
  inputProps,
  buttonProps,
}: Props): React.Node {
  const button = React.createElement(Button, buttonProps);
  return (
    <Form {...formProps}>
      <Form.InputGroup inputProps={inputProps} append={button} />
    </Form>
  );
}

export default FormWithSingleInputAndButton;