Skip to content

Commit

Permalink
fix: Adding missing prop placeholder in Input component
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasOmar committed Jan 17, 2024
1 parent 98a42da commit eab77b0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/components/atoms/Input/index.mocks.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
"basicExample": {
"type": "text"
},
"withPlaceholder": {
"placeholder": "Here the user will see this until you type something"
},
"withText": {
"text": "Welcome to reactive-bulma"
},
Expand Down
3 changes: 3 additions & 0 deletions src/components/atoms/Input/index.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ const Template: StoryFn<typeof Input> = args => <Input {...args} />

export const BasicExample = Template.bind({})

export const WithPlaceholder = Template.bind({})
WithPlaceholder.args = testing.withPlaceholder as InputProps

export const WithText = Template.bind({})
WithText.args = testing.withText as InputProps

Expand Down
2 changes: 2 additions & 0 deletions src/components/atoms/Input/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const Input: React.FC<InputProps> = ({
style = null,
type,
text = null,
placeholder = null,
isDisabled = false,
isReadonly = false,
color = null,
Expand Down Expand Up @@ -40,6 +41,7 @@ const Input: React.FC<InputProps> = ({
<input
data-testid={inputTestId}
type={type}
placeholder={placeholder ?? undefined}
defaultValue={text ?? undefined}
disabled={isDisabled}
readOnly={isReadonly}
Expand Down
2 changes: 2 additions & 0 deletions src/interfaces/atomProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ export interface InputProps extends ElementProps, ClickeableProps {
type: inputTypes
/** `Attribute` The value that will be shown on the input */
text?: string
/** `Attribute` The text that will be shown if the user does not type any value */
placeholder?: string
/** `Attribute` Will disable the input */
isDisabled?: boolean
/** `Attribute` Will show the input as a normal one, but is not editable and has no shadow */
Expand Down

0 comments on commit eab77b0

Please sign in to comment.