From 2e3c687c0b5e8b41398285a153da62121f78c255 Mon Sep 17 00:00:00 2001 From: Evan Sharp Date: Tue, 27 Jun 2017 11:45:12 -0400 Subject: [PATCH] fix(Alert): map close class css modules (#471) Also adds ability to add additional classes to the close button closes #470 --- docs/lib/Components/AlertsPage.js | 1 + src/Alert.js | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/lib/Components/AlertsPage.js b/docs/lib/Components/AlertsPage.js index dfe9e4be8..aca94d71d 100644 --- a/docs/lib/Components/AlertsPage.js +++ b/docs/lib/Components/AlertsPage.js @@ -34,6 +34,7 @@ export default class AlertsPage extends React.Component { {`Alert.propTypes = { className: PropTypes.string, + closeClassName: PropTypes.string, color: PropTypes.string, // default: 'success' isOpen: PropTypes.bool, // default: true toggle: PropTypes.func, diff --git a/src/Alert.js b/src/Alert.js index 8717b6fd0..970947823 100644 --- a/src/Alert.js +++ b/src/Alert.js @@ -11,6 +11,7 @@ const FirstChild = ({ children }) => ( const propTypes = { children: PropTypes.node, className: PropTypes.string, + closeClassName: PropTypes.string, cssModule: PropTypes.object, color: PropTypes.string, isOpen: PropTypes.bool, @@ -33,6 +34,7 @@ const defaultProps = { const Alert = (props) => { const { className, + closeClassName, cssModule, tag: Tag, color, @@ -52,10 +54,12 @@ const Alert = (props) => { { 'alert-dismissible': toggle } ), cssModule); + const closeClasses = mapToCssModules(classNames('close', closeClassName), cssModule); + const alert = ( { toggle ? - : null }