Skip to content
This repository was archived by the owner on Mar 1, 2024. It is now read-only.

Commit

Permalink
fix(FormInputGroup): make breaking change non-breaking
Browse files Browse the repository at this point in the history
  • Loading branch information
jonthomp committed Jun 2, 2018
1 parent e934849 commit cf963e7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions example/src/FormElementsPage.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,15 +158,15 @@ function FormElements() {
<Form.Group label="Input Group Buttons">
<Form.InputGroup>
<Form.Input />
<Form.InputGroupAppend>
<Form.InputGroup append>
<Button color="primary">Actions</Button>
<Button.Dropdown color="primary">
<Dropdown.Item>News</Dropdown.Item>
<Dropdown.Item>Messages</Dropdown.Item>
<Dropdown.ItemDivider />
<Dropdown.Item>Edit Profile</Dropdown.Item>
</Button.Dropdown>
</Form.InputGroupAppend>
</Form.InputGroup>
</Form.InputGroup>
</Form.Group>
</ComponentDemo>
Expand Down
8 changes: 8 additions & 0 deletions src/components/Form/FormInputGroup.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ function FormInputGroup(props: Props): React.Node {
const Component = RootComponent || "div";
const children = inputProps ? <Form.Input {...inputProps} /> : props.children;

if (prepend === true) {
return <FormInputGroupPrepend>{children}</FormInputGroupPrepend>;
}

if (append === true) {
return <FormInputGroupAppend>{children}</FormInputGroupAppend>;
}

return (
<Component className={classes}>
{prepend && <FormInputGroupPrepend>{prepend}</FormInputGroupPrepend>}
Expand Down

0 comments on commit cf963e7

Please sign in to comment.