Skip to content

Commit

Permalink
feat: add placeholder to QueryItem's TextInput
Browse files Browse the repository at this point in the history
  • Loading branch information
ZoeAstra committed May 1, 2024
1 parent e74053d commit 30bde49
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
22 changes: 19 additions & 3 deletions src/components/data-entry/QueryItem/TextInput.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,22 @@ export default meta;

type Story = StoryObj<typeof QueryItem.ValueSelector.TextInput>

export const Primary: Story = {

}
export const Default: Story = {
args: {
value: 'Primary',
},
}


export const Placeholder: Story = {
args: {
placeholder: 'Placeholder',
},
}


export const ErrorMessage: Story = {
args: {
errorMessage: 'Required field!',
},
}
2 changes: 2 additions & 0 deletions src/components/data-entry/QueryItem/TextInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ interface ITextInputProps {
value?: string
disabled?: boolean
errorMessage?: string
placeholder?: string
}

export const TextInput = (props: ITextInputProps) => {
Expand All @@ -28,6 +29,7 @@ export const TextInput = (props: ITextInputProps) => {
disabled={props.disabled}
className={inputClasses}
value={props.value}
placeholder={props.placeholder}
onChange={_onChange}></Input>
{props.errorMessage && <Typography.Text type="danger">{props.errorMessage}</Typography.Text>}
</>
Expand Down

0 comments on commit 30bde49

Please sign in to comment.