Skip to content

Commit

Permalink
Clean codebase a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
fkhadra committed Mar 9, 2018
1 parent af7383f commit 777a3e2
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 25 deletions.
2 changes: 1 addition & 1 deletion dist/ReactToastify.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/ReactToastify.min.js.map

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions src/ProgressBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@ function ProgressBar({
}) {
return (
<div
{...(typeof className !== 'string'
? css(styles(type, isRunning, hide, delay, rtl), className)
: styles(type, isRunning, hide, delay, rtl))}
{...css(
styles(type, isRunning, hide, delay, rtl),
typeof className !== 'string' && className
)}
{...typeof className === 'string' && { className }}
onAnimationEnd={closeToast}
/>
Expand Down
20 changes: 11 additions & 9 deletions src/Toast.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ class Toast extends Component {
hideProgressBar: false,
onOpen: null,
onClose: null,
className: '',
bodyClassName: '',
progressClassName: '',
className: null,
bodyClassName: null,
progressClassName: null,
updateId: null,
role: 'alert'
};
Expand Down Expand Up @@ -156,16 +156,18 @@ class Toast extends Component {
position={position}
>
<div
{...(typeof className !== 'string'
? css(styles.container(type, rtl), className)
: styles.container(type, rtl))}
{...css(
styles.container(type, rtl),
typeof className !== 'string' && className
)}
{...this.getToastProps()}
>
<div
{...this.props.in && { role: role }}
{...(typeof bodyClassName !== 'string'
? css(styles.body, bodyClassName)
: styles.body)}
{...css(
styles.body,
typeof bodyClassName !== 'string' && bodyClassName
)}
{...typeof bodyClassName === 'string' && {
className: bodyClassName
}}
Expand Down
13 changes: 7 additions & 6 deletions src/ToastContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ class ToastContainer extends Component {
newestOnTop: false,
className: null,
style: null,
toastClassName: '',
bodyClassName: '',
progressClassName: ''
toastClassName: null,
bodyClassName: null,
progressClassName: null
};

/**
Expand Down Expand Up @@ -348,9 +348,10 @@ class ToastContainer extends Component {

return (
<TransitionGroup
{...(typeof className !== 'string'
? css(styles(disablePointer, position), className)
: styles(disablePointer, position))}
{...css(
styles(disablePointer, position),
typeof className !== 'string' && className
)}
{...typeof className === 'string' && { className }}
{...style !== null && { style }}
key={`container-${position}`}
Expand Down
2 changes: 0 additions & 2 deletions src/__tests__/__snapshots__/Toast.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,10 @@ exports[`Toast Should support Rtl display 1`] = `
unmountOnExit={true}
>
<div
className=""
data-css-1nz94ll=""
onClick={[Function]}
>
<div
className=""
data-css-w74h2a=""
role="alert"
>
Expand Down
6 changes: 3 additions & 3 deletions src/__tests__/__snapshots__/ToastContainer.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ exports[`ToastContainer Should allow glamor rule as className 1`] = `
<ToastContainer
autoClose={5000}
bodyClassName=""
bodyClassName={null}
className={
Object {
"data-glamor-0": "",
Expand All @@ -24,10 +24,10 @@ exports[`ToastContainer Should allow glamor rule as className 1`] = `
newestOnTop={false}
pauseOnHover={true}
position="top-right"
progressClassName=""
progressClassName={null}
rtl={false}
style={null}
toastClassName=""
toastClassName={null}
transition={[Function]}
>
<div />
Expand Down

0 comments on commit 777a3e2

Please sign in to comment.