Skip to content

Commit 5e01630

Browse files
committed
refactor(CToast): improve and clean-up syntax
1 parent 1fe1e34 commit 5e01630

File tree

1 file changed

+4
-9
lines changed
  • packages/coreui-react/src/components/toast

1 file changed

+4
-9
lines changed

packages/coreui-react/src/components/toast/CToast.tsx

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ export const CToast = forwardRef<HTMLDivElement, CToastProps>(
118118
<Transition
119119
in={_visible}
120120
nodeRef={toastRef}
121-
onEnter={() => onShow && onShow(index ? index : null)}
122-
onExited={() => onClose && onClose(index ? index : null)}
121+
onEnter={() => onShow && onShow(index ?? null)}
122+
onExited={() => onClose && onClose(index ?? null)}
123123
timeout={250}
124124
unmountOnExit
125125
>
@@ -132,14 +132,9 @@ export const CToast = forwardRef<HTMLDivElement, CToastProps>(
132132
fade: animation,
133133
[`bg-${color}`]: color,
134134
'border-0': color,
135+
'show showing': state === 'entering' || state === 'exiting',
136+
show: state === 'entered',
135137
},
136-
state === 'entering'
137-
? 'show showing'
138-
: state === 'entered'
139-
? 'show'
140-
: state === 'exiting'
141-
? 'show showing'
142-
: '',
143138
className,
144139
)}
145140
aria-live="assertive"

0 commit comments

Comments
 (0)