Skip to content

Commit

Permalink
feat: add input field to design system
Browse files Browse the repository at this point in the history
  • Loading branch information
hannahouazzane committed Sep 22, 2023
1 parent e878dfc commit b0313f9
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 0 deletions.
1 change: 1 addition & 0 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { MockedProvider } from '@apollo/client/testing';
// Import design system component styles for our Stories.
import '../src/design-system/components/Badge/Badge.css';
import '../src/design-system/components/Button/Button.css';
import '../src/design-system/components/InputField/InputField.css';

export const parameters = {
actions: { argTypesRegex: '^on[A-Z].*' },
Expand Down
8 changes: 8 additions & 0 deletions src/design-system/components/InputField/InputField.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.input-field {
display: block;
width: 100%;
margin-top: var(--space-3xs);
padding: var(--space-2xs);
color: var(--color-blue);
border: 1px solid var(--color-blue);
}
24 changes: 24 additions & 0 deletions src/design-system/components/InputField/InputField.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { Meta } from '@storybook/react';

import InputField from './InputField';
import React from 'react';

export default {
title: 'Design-System/Form Elements/Input Field',
component: InputField,
args: {
placeholder: 'Enter a location e.g. London',
},
parameters: {
iframeHeight: 200,
docs: {
description: {
component:
'This component accepts data from the user and has the props associated with an input field',
},
iframeHeight: 200,
},
},
} as Meta;

export const Default = (args) => <InputField {...args} />;
8 changes: 8 additions & 0 deletions src/design-system/components/InputField/InputField.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { forwardRef } from 'react';

const InputField = forwardRef<HTMLInputElement>((props, ref) => {
return <input ref={ref} className="input" {...props} />;
});

InputField.displayName = 'InputField';
export default InputField;
3 changes: 3 additions & 0 deletions src/design-system/components/InputField/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import InputField from './InputField';

export default InputField;
1 change: 1 addition & 0 deletions src/design-system/components/stylesheet.css
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
@import 'src/design-system/components/Badge/Badge.css';
@import 'src/design-system/components/Button/Button.css';
@import 'src/design-system/components/InputField/InputField.css';

0 comments on commit b0313f9

Please sign in to comment.