Skip to content

Commit

Permalink
Add rounded prop to Form.Input
Browse files Browse the repository at this point in the history
  • Loading branch information
kennethnym committed Jan 1, 2021
1 parent 3833a6e commit af1c3a2
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ exports[`Input component Should be large and readOnly 1`] = `
/>
`;

exports[`Input component Should be rounded 1`] = `
<input
className="input is-rounded"
readOnly={false}
type="text"
/>
`;

exports[`Input component Should be type email and a with success colors 1`] = `
<input
className="input is-success"
Expand Down
4 changes: 4 additions & 0 deletions src/components/form/components/__test__/input.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,8 @@ describe('Input component', () => {
const component = renderer.create(<Input hovered focused />);
expect(component.toJSON()).toMatchSnapshot();
});
it('Should be rounded', () => {
const component = renderer.create(<Input rounded />);
expect(component.toJSON()).toMatchSnapshot();
});
});
4 changes: 4 additions & 0 deletions src/components/form/components/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const Input = ({
readOnly,
isStatic,
hovered,
rounded,
focused,
name,
...props
Expand All @@ -27,6 +28,7 @@ const Input = ({
'is-static': isStatic,
'is-hovered': hovered,
'is-focused': focused,
'is-rounded': rounded,
[`is-${size}`]: size,
[`is-${color}`]: color,
})}
Expand All @@ -43,6 +45,7 @@ Input.propTypes = {
isStatic: PropTypes.bool,
focused: PropTypes.bool,
hovered: PropTypes.bool,
rounded: PropTypes.bool,
/**
* The name of the input field Commonly used for [multi-input handling](https://reactjs.org/docs/forms.html#handling-multiple-inputs)
*/
Expand All @@ -60,6 +63,7 @@ Input.defaultProps = {
isStatic: false,
focused: false,
hovered: false,
rounded: false,
name: undefined,
};

Expand Down

0 comments on commit af1c3a2

Please sign in to comment.