Skip to content

Commit

Permalink
feat: add support for id attribute to SubmitButton on #input
Browse files Browse the repository at this point in the history
  • Loading branch information
tujoworker committed May 5, 2019
1 parent 45a3086 commit 66cef71
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
5 changes: 4 additions & 1 deletion packages/dnb-ui-lib/src/components/input/Input.js
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ export default class Input extends PureComponent {

class SubmitButton extends PureComponent {
static propTypes = {
id: PropTypes.string,
value: PropTypes.string,
title: PropTypes.string,
variant: ButtonPropTypes.variant,
Expand All @@ -380,6 +381,7 @@ class SubmitButton extends PureComponent {
}

static defaultProps = {
id: null,
value: null,
title: null,
disabled: false,
Expand Down Expand Up @@ -414,9 +416,10 @@ class SubmitButton extends PureComponent {
dispatchCustomElementEvent(this, 'on_submit', { value, event })
}
render() {
const { title, disabled, variant, icon, icon_size } = this.props
const { id, title, disabled, variant, icon, icon_size } = this.props

const params = {
id,
type: 'submit',
title,
disabled
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ exports[`Input component have to match type="search" snapshot 1`] = `
"disabled": "disabled",
"icon": "icon",
"icon_size": "icon_size",
"id": "id",
"on_submit": [Function],
"on_submit_blur": [Function],
"on_submit_focus": [Function],
Expand Down Expand Up @@ -157,6 +158,7 @@ exports[`Input component have to match type="search" snapshot 1`] = `
"disabled": "disabled",
"icon": "icon",
"icon_size": "icon_size",
"id": "id",
"on_submit": [Function],
"on_submit_blur": [Function],
"on_submit_focus": [Function],
Expand Down Expand Up @@ -218,7 +220,7 @@ exports[`Input component have to match type="search" snapshot 1`] = `
icon="search"
icon_position="right"
icon_size="default"
id={null}
id="input"
innerRef={null}
onBlur={[Function]}
onClick={[Function]}
Expand All @@ -231,7 +233,8 @@ exports[`Input component have to match type="search" snapshot 1`] = `
variant="secondary"
>
<button
className="dnb-button dnb-button--secondary dnb-button--size-medium dnb-button--icon-position-right dnb-button--has-icon dnb-input__submit-button__button"
className="dnb-button dnb-button--secondary dnb-button--size-medium dnb-button--icon-position-right dnb-button--has-icon input dnb-input__submit-button__button"
id="input"
onBlur={[Function]}
onClick={[Function]}
onFocus={[Function]}
Expand All @@ -251,7 +254,7 @@ exports[`Input component have to match type="search" snapshot 1`] = `
icon="search"
icon_position="right"
icon_size="default"
id={null}
id="input"
innerRef={null}
isIconOnly={true}
onBlur={[Function]}
Expand Down Expand Up @@ -376,6 +379,7 @@ exports[`Input component have to match type="text" snapshot 1`] = `
"disabled": "disabled",
"icon": "icon",
"icon_size": "icon_size",
"id": "id",
"on_submit": [Function],
"on_submit_blur": [Function],
"on_submit_focus": [Function],
Expand Down

0 comments on commit 66cef71

Please sign in to comment.