Skip to content
This repository has been archived by the owner on Mar 30, 2021. It is now read-only.

Feature/input component #9

Merged
merged 3 commits into from
Mar 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/components/Input/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ const Input = ({
checked,
customStyles,
className,
width,
}) => (
<styles.Container>
<styles.Container width={width}>
<styles.Input
id={id}
name={name}
Expand All @@ -32,6 +33,7 @@ const Input = ({
hasIcon={checked}
customStyles={customStyles}
className={className}
width={width}
/>

{checked && <styles.Icon src={checkIcon} alt="Check" />}
Expand All @@ -53,6 +55,7 @@ Input.propTypes = {
checked: PropTypes.bool,
customStyles: PropTypes.object,
className: PropTypes.string,
width: PropTypes.string,
};

Input.defaultProps = {
Expand All @@ -67,6 +70,7 @@ Input.defaultProps = {
checked: false,
customStyles: {},
className: '',
width: '100%',
};

export default Input;
1 change: 1 addition & 0 deletions src/components/Input/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export const Input = styled.input`

export const Container = styled.div`
position: relative;
width: ${({ width }) => width};
`;

export const Icon = styled.img`
Expand Down
4 changes: 4 additions & 0 deletions src/components/InputCurrency/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const InputCurrency = ({
customStyles,
checked,
className,
width,
}) => (
<Input
id={id}
Expand All @@ -32,6 +33,7 @@ const InputCurrency = ({
customStyles={customStyles}
checked={checked}
className={className}
width={width}
/>
);

Expand All @@ -47,6 +49,7 @@ InputCurrency.propTypes = {
customStyles: PropTypes.object,
checked: PropTypes.bool,
className: PropTypes.string,
width: PropTypes.string,
};

InputCurrency.defaultProps = {
Expand All @@ -60,6 +63,7 @@ InputCurrency.defaultProps = {
checked: false,
customStyles: {},
className: '',
width: '100%',
};

export default InputCurrency;
6 changes: 6 additions & 0 deletions src/stories/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ storiesOf('Input', module)
onChange={handleChange}
value={state.primary}
placeholder="Primary style"
width="250px"
/>
)))
.add('Disabled style', customWithInfo()(state => (
Expand All @@ -34,6 +35,7 @@ storiesOf('Input', module)
onChange={handleChange}
value={state.disabled}
placeholder="Disabled style"
width="250px"
disabled
/>
)))
Expand All @@ -43,6 +45,7 @@ storiesOf('Input', module)
onChange={handleChange}
value={state.error}
placeholder="Error style"
width="250px"
error
/>
)))
Expand All @@ -52,6 +55,7 @@ storiesOf('Input', module)
onChange={handleChange}
value={state.checked}
placeholder="Checked style"
width="250px"
checked
/>
)))
Expand All @@ -61,6 +65,7 @@ storiesOf('Input', module)
onChange={handleChange}
value={state.disabledChecked}
placeholder="Disabled checked style"
width="250px"
disabled
checked
/>
Expand All @@ -71,6 +76,7 @@ storiesOf('Input', module)
onChange={handleChange}
value={state.custom}
placeholder="Custom style"
width="250px"
customStyles={{
backgroundColor: '#f1f1f1',
color: '#118473',
Expand Down
6 changes: 6 additions & 0 deletions src/stories/inputCurrency.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ storiesOf('InputCurrency', module)
onChange={handleChange}
value={state.primary}
placeholder="Primary style"
width="250px"
/>
)))
.add('Disabled style', customWithInfo()(state => (
Expand All @@ -34,6 +35,7 @@ storiesOf('InputCurrency', module)
onChange={handleChange}
value={state.disabled}
placeholder="Disabled style"
width="250px"
disabled
/>
)))
Expand All @@ -43,6 +45,7 @@ storiesOf('InputCurrency', module)
onChange={handleChange}
value={state.error}
placeholder="Error style"
width="250px"
error
/>
)))
Expand All @@ -52,6 +55,7 @@ storiesOf('InputCurrency', module)
onChange={handleChange}
value={state.checked}
placeholder="Checked style"
width="250px"
checked
/>
)))
Expand All @@ -61,6 +65,7 @@ storiesOf('InputCurrency', module)
onChange={handleChange}
value={state.disabledChecked}
placeholder="Disabled checked style"
width="250px"
disabled
checked
/>
Expand All @@ -71,6 +76,7 @@ storiesOf('InputCurrency', module)
onChange={handleChange}
value={state.custom}
placeholder="Custom style"
width="250px"
customStyles={{
backgroundColor: '#f1f1f1',
color: '#118473',
Expand Down