Skip to content

Commit

Permalink
feat: extend #form-stauts to send along rest properties
Browse files Browse the repository at this point in the history
  • Loading branch information
tujoworker committed Feb 21, 2019
1 parent f1e8ca7 commit 1cb47d3
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions packages/dnb-ui-lib/src/components/form-status/FormStatus.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export const propTypes = {
icon_size: PropTypes.string,
status: PropTypes.oneOf(['error', 'info']),
hidden: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
text_id: PropTypes.string,
class: PropTypes.string,
animation: PropTypes.string,

Expand All @@ -50,6 +51,7 @@ export const defaultProps = {
icon_size: 'default',
status: 'error',
hidden: false,
text_id: null,
class: null,
animation: null, // could be 'fade-in'

Expand Down Expand Up @@ -103,7 +105,13 @@ export default class FormStatus extends PureComponent {
hidden,
className,
animation,
class: _className
class: _className,
text_id,
text /* eslint-disable-line */,
icon /* eslint-disable-line */,
icon_size /* eslint-disable-line */,
children /* eslint-disable-line */,
...attributes
} = this.props

const iconToRender = FormStatus.getIcon(this.props)
Expand All @@ -121,7 +129,13 @@ export default class FormStatus extends PureComponent {
className,
_className
),
title
title,

...attributes
}
const textParams = {
className: 'dnb-form-status--text',
id: text_id
}

if (hidden) {
Expand All @@ -133,11 +147,12 @@ export default class FormStatus extends PureComponent {

// also used for code markup simulation
validateDOMAttributes(this.props, params)
validateDOMAttributes(null, textParams)

return (
<span {...params}>
{iconToRender}
<span className="dnb-form-status--text">{contentToRender}</span>
<span {...textParams}>{contentToRender}</span>
</span>
)
}
Expand Down

0 comments on commit 1cb47d3

Please sign in to comment.