Skip to content

Commit

Permalink
feat: add fullWidth prop for Input component (#35)
Browse files Browse the repository at this point in the history
- Add fullWidth prop to Input component
- Add FullWidthInput story
  • Loading branch information
amalv committed Nov 7, 2019
1 parent e12a748 commit 9497060
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/components/Input.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ export default {

export const DefaultInput: React.FC = () => <Input />;

export const FullWidthInput: React.FC = () => <Input fullWidth />;

export const EmailInput: React.FC = () => (
<Input label="email" placeholder="my@email.com" borderColor="#6200ee" />
);
1 change: 1 addition & 0 deletions src/components/Input.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export interface InputStyledProps {
variant: string;
bordercolor: string;
InputLabelProps: object;
fullWidth?: boolean;
}

export const InputStyled = styled(TextField as React.FC<InputStyledProps>)`
Expand Down
3 changes: 3 additions & 0 deletions src/components/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ interface InputProps {
placeholder?: string;
label?: string;
borderColor?: string;
fullWidth?: boolean;
}

export const Input: React.FC<InputProps> = ({
placeholder,
label,
borderColor,
fullWidth,
}: InputProps) => {
const placeholderProp = placeholder || "Placeholder";
const labelProp = label || "Label";
Expand All @@ -28,6 +30,7 @@ export const Input: React.FC<InputProps> = ({
}}
variant="outlined"
bordercolor={borderColorProp}
fullWidth={fullWidth}
/>
</StylesProvider>
);
Expand Down

1 comment on commit 9497060

@vercel
Copy link

@vercel vercel bot commented on 9497060 Nov 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.