Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
fix(prop-types): adjust statusPropType and use custom one for AlertBar
Browse files Browse the repository at this point in the history
  • Loading branch information
HendrikThePendric authored and varl committed Nov 25, 2019
1 parent bfccdad commit 85d40ba
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 9 additions & 4 deletions src/AlertBar/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import cx from 'classnames'
import propTypes from 'prop-types'
import React, { PureComponent } from 'react'
import { mutuallyExclusive } from '@dhis2/prop-types'

import { statusPropType } from '../common-prop-types'
import { Actions, actionsPropType } from './Actions'
import { Dismiss } from './Dismiss'
import { Icon, iconPropType } from './Icon'
Expand Down Expand Up @@ -120,12 +120,17 @@ class AlertBar extends PureComponent {
}
}

const alertTypePropType = mutuallyExclusive(
['success', 'warning', 'critical'],
propTypes.bool
)

AlertBar.propTypes = {
className: propTypes.string,
children: propTypes.string.isRequired,
success: statusPropType,
warning: statusPropType,
critical: statusPropType,
success: alertTypePropType,
warning: alertTypePropType,
critical: alertTypePropType,
icon: iconPropType,
duration: propTypes.number,
permanent: propTypes.bool,
Expand Down
2 changes: 1 addition & 1 deletion src/common-prop-types/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { mutuallyExclusive } from '@dhis2/prop-types'
import propTypes from 'prop-types'

export const statusPropType = mutuallyExclusive(
['success', 'warning', 'critical'],
['valid', 'warning', 'error'],
propTypes.bool
)

Expand Down

0 comments on commit 85d40ba

Please sign in to comment.