Skip to content

Commit

Permalink
Merge de0bddc into b49177c
Browse files Browse the repository at this point in the history
  • Loading branch information
fkhadra committed Sep 24, 2018
2 parents b49177c + de0bddc commit 0925c17
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 41 deletions.
40 changes: 20 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
- [Remove a toast programmatically](#remove-a-toast-programmatically)
- [Usage with redux](#usage-with-redux)
- [Pause toast timer when the window loses focus](#pause-toast-timer-when-the-window-loses-focus)
- [Use a custom toastId](#use-a-custom-toast-id)
- [Use a custom id](#use-a-custom-id)
- [Prevent duplicate](#prevent-duplicate)
- [Update a toast](#update-a-toast)
- [Basic example](#basic-example)
Expand Down Expand Up @@ -134,29 +134,29 @@ For convenience, toast expose a POSITION property to avoid any typo.

class Position extends Component {
notify = () => {
toast("Default Notification !");
toast("Default Notification !");

toast.success("Success Notification !", {
position: toast.POSITION.TOP_CENTER
});
toast.success("Success Notification !", {
position: toast.POSITION.TOP_CENTER
});

toast.error("Error Notification !", {
position: toast.POSITION.TOP_LEFT
});
toast.error("Error Notification !", {
position: toast.POSITION.TOP_LEFT
});

toast.warn("Warning Notification !", {
position: toast.POSITION.BOTTOM_LEFT
});
toast.warn("Warning Notification !", {
position: toast.POSITION.BOTTOM_LEFT
});

toast.info("Info Notification !", {
position: toast.POSITION.BOTTOM_CENTER
});
toast.info("Info Notification !", {
position: toast.POSITION.BOTTOM_CENTER
});

toast("Custom Style Notification with css class!", {
position: toast.POSITION.BOTTOM_RIGHT,
className: 'foo-bar'
});
};
toast("Custom Style Notification with css class!", {
position: toast.POSITION.BOTTOM_RIGHT,
className: 'foo-bar'
});
};

render(){
return <button onClick={this.notify}>Notify</button>;
Expand Down Expand Up @@ -296,7 +296,7 @@ toast('Hello', {
})
```

### Use a custom toastId
### Use a custom id

A custom `toastId` can be used to replace the one generated. You can use a `number` or a `string`.

Expand Down
8 changes: 4 additions & 4 deletions dist/ReactToastify.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

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

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions scss/animations/_slide.scss
Original file line number Diff line number Diff line change
Expand Up @@ -62,23 +62,23 @@
}
}

@keyframes #{$rt-namespace}__slideOutUp {
@keyframes #{$rt-namespace}__slideOutDown {
from {
@include transform;
}
to {
visibility: hidden;
transform: translate3d(0, 110%, 0);
transform: translate3d(0, 500px, 0);
}
}

@keyframes #{$rt-namespace}__slideOutDown {
@keyframes #{$rt-namespace}__slideOutUp {
from {
@include transform;
}
to {
visibility: hidden;
transform: translate3d(0, -110%, 0);
transform: translate3d(0, -500px, 0);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/Toast.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function getY(e) {
: e.clientY;
}

const noop = () => { };
const noop = () => {};

class Toast extends Component {
static propTypes = {
Expand Down
16 changes: 7 additions & 9 deletions src/components/ToastContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,9 @@ class ToastContainer extends Component {
return closeButton === false
? false
: cloneElement(closeButton, {
closeToast: () => this.removeToast(toastId),
type: type
});
closeToast: () => this.removeToast(toastId),
type: type
});
}

getAutoCloseDelay(toastAutoClose) {
Expand Down Expand Up @@ -259,7 +259,7 @@ class ToastContainer extends Component {
: this.props.draggable,
draggablePercent:
typeof options.draggablePercent === 'number' &&
!isNaN(options.draggablePercent)
!isNaN(options.draggablePercent)
? options.draggablePercent
: this.props.draggablePercent,
closeOnClick:
Expand Down Expand Up @@ -339,18 +339,16 @@ class ToastContainer extends Component {

// group toast by position
collection.forEach(toastId => {
const {position, options, content} = this.collection[toastId];
const { position, options, content } = this.collection[toastId];
toastToRender[position] || (toastToRender[position] = []);

if (this.state.toast.indexOf(options.id) !== -1) {
toastToRender[position].push(
this.makeToast(content, options)
);
toastToRender[position].push(this.makeToast(content, options));
} else {
toastToRender[position].push(null);
delete this.collection[toastId];
}
})
});

return Object.keys(toastToRender).map(position => {
const disablePointer =
Expand Down

0 comments on commit 0925c17

Please sign in to comment.