Skip to content

Commit 96e98fe

Browse files
committed
refactor: CAlert: delete transition prop
1 parent 955370e commit 96e98fe

File tree

1 file changed

+9
-17
lines changed

1 file changed

+9
-17
lines changed

src/CAlert.js

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ const CAlert = props => {
1212
//
1313
onShowChange,
1414
closeButton,
15-
transition,
1615
color,
1716
fade,
1817
show,
@@ -30,11 +29,11 @@ const CAlert = props => {
3029
)
3130

3231
const alertTransition = {
33-
...CFade.defaultProps,
34-
...transition,
35-
baseClass: fade ? transition.baseClass : '',
36-
timeout: fade ? transition.timeout : 0
32+
baseClass: fade ? CFade.baseClass : '',
33+
timeout: fade ? CFade.timeout : 0,
34+
unmountOnExit: true
3735
}
36+
3837
const [isOpen, setIsOpen] = useState(show)
3938

4039
useEffect(() => {
@@ -63,10 +62,8 @@ const CAlert = props => {
6362
role="alert"
6463
{...attributes}
6564
>
66-
{children}
67-
{closeButton && <CButtonClose
68-
onClick={() => setIsOpen(false)}
69-
/>}
65+
{ children }
66+
{ closeButton && <CButtonClose onClick={() => setIsOpen(false)} />}
7067
</CFade>
7168
)
7269
}
@@ -81,18 +78,13 @@ CAlert.propTypes = {
8178
color: PropTypes.string,
8279
fade: PropTypes.bool,
8380
show: PropTypes.oneOfType([PropTypes.bool, PropTypes.number]),
84-
transition: PropTypes.shape(CFade.propTypes),
8581
};
8682

8783
CAlert.defaultProps = {
8884
tag: 'div',
8985
//
9086
show: true,
91-
fade: true,
92-
transition: {
93-
...CFade.defaultProps,
94-
unmountOnExit: true,
95-
}
96-
}
97-
//export
87+
fade: true
88+
};
89+
9890
export default CAlert

0 commit comments

Comments
 (0)