Skip to content

Commit f94778e

Browse files
committed
Refactored samples to pass linter
1 parent 2747814 commit f94778e

File tree

12 files changed

+44
-38
lines changed

12 files changed

+44
-38
lines changed

samples/js/components/Content.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import React from "react";
22
import Highlight from "react-highlight";
3-
import { install, usage } from "../helpers/code";
4-
import ContainerExample from "./examples/ContainerExample";
5-
import TypeExample from "./examples/TypeExample";
6-
import InsertExample from "./examples/InsertExample";
7-
import AnimationWrapper from "./examples/AnimationExample";
8-
import CustomContentExample from "./examples/CustomContentExample";
9-
import UsageExample from "./examples/UsageExample";
3+
import { install, } from "helpers/code";
4+
import ContainerExample from "components/examples/ContainerExample";
5+
import TypeExample from "components/examples/TypeExample";
6+
import InsertExample from "components/examples/InsertExample";
7+
import AnimationWrapper from "components/examples/AnimationExample";
8+
import CustomContentExample from "components/examples/CustomContentExample";
9+
import UsageExample from "components/examples/UsageExample";
1010

1111
function NPMInstall() {
1212
return (
@@ -34,7 +34,7 @@ function ExampleHeading() {
3434
</div>
3535
</div>
3636
);
37-
};
37+
}
3838

3939
const Examples = ({ addNotification }) => {
4040
return (

samples/js/components/Header.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from "react";
22

3-
export default function Header({ instance }) {
3+
export default function Header() {
44
return (
55
<div className="header">
66
<div className="header-content">
@@ -9,6 +9,7 @@ export default function Header({ instance }) {
99
<div className="header-buttons">
1010
<a
1111
target="_blank"
12+
rel="noopener noreferrer"
1213
className="btn btn-primary no-corner"
1314
href={"https://github.com/teodosii/react-notifications-component"}
1415
>

samples/js/components/examples/AnimationExample.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import React from "react";
2-
import notification from "../../helpers/notification";
2+
import notification from "helpers/notification";
33
import {
44
getContainer,
55
getType,
6-
getMessage,
7-
getTitle
8-
} from "../../helpers/randomize";
6+
getMessage
7+
} from "helpers/randomize";
98

109
function AnimationInExample({ addNotification }) {
1110
const add = (htmlClasses) => {

samples/js/components/examples/ContainerExample.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import React from "react";
2-
import notification from "../../helpers/notification";
2+
import notification from "helpers/notification";
33
import {
44
getType,
55
getMessage,
66
getTitle
7-
} from "../../helpers/randomize";
7+
} from "helpers/randomize";
88

99
export default class ContainerExample extends React.Component {
1010
constructor(props) {

samples/js/components/examples/CustomContentExample.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from "react";
2-
import notification from "../../helpers/notification";
3-
import reactImage from "../../../images/react.png";
4-
import { getContainer } from "../../helpers/randomize";
2+
import notification from "helpers/notification";
3+
import reactImage from "images/react.png";
4+
import { getContainer } from "helpers/randomize";
55

66
export default class CustomContentExample extends React.Component {
77
constructor(props) {

samples/js/components/examples/InsertExample.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import React from "react";
2-
import notification from "../../helpers/notification";
2+
import notification from "helpers/notification";
33
import {
4-
getContainer,
54
getType,
65
getMessage,
76
getTitle
8-
} from "../../helpers/randomize";
7+
} from "helpers/randomize";
98

109
export default function InsertExample({ addNotification }) {
1110
const add = (insert) => {

samples/js/components/examples/TypeExample.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import React from "react";
2-
import notification from "../../helpers/notification";
2+
import notification from "helpers/notification";
33
import {
44
getContainer,
55
getMessage,
66
getTitle
7-
} from "../../helpers/randomize";
7+
} from "helpers/randomize";
88

99
export default class TypeExample extends React.Component {
1010
constructor(props) {

samples/js/components/examples/UsageExample.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
import React from "react";
22
import Highlight from "react-highlight";
3-
import { usage } from "../../helpers/code";
4-
import notification from "../../helpers/notification";
5-
import notificationObject from "../../../../tests/mocks/notification.mock";
3+
import { usage } from "helpers/code";
64

7-
export default function UsageExample({ addNotification }) {
5+
export default function UsageExample() {
86
return (
97
<div className="row">
108
<div className="col-lg-8 offset-lg-2 column col-md-10 offset-md-1 col-sm-12 heading">

samples/js/helpers/code.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ class App extends React.Component {
77
constructor(props) {
88
super(props);
99
this.addNotification = this.addNotification.bind(this);
10+
this.notificationDOMRef = React.createRef();
1011
}
1112
1213
addNotification() {
13-
this.notificationDOMRef.addNotification({
14+
this.notificationDOMRef.current.addNotification({
1415
title: "Awesomeness",
1516
message: "Awesome Notifications!",
1617
type: "success",
@@ -26,7 +27,7 @@ class App extends React.Component {
2627
render() {
2728
return (
2829
<div className="app-content">
29-
<ReactNotification ref={input => this.notificationDOMRef = input} />
30+
<ReactNotification ref={this.notificationDOMRef} />
3031
<button onClick={this.addNotification} className="btn btn-primary">
3132
Add Awesome Notification
3233
</button>

samples/js/helpers/notification.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import React from "react";
2-
31
export default {
42
title: "Awesomeness",
53
message: "Awesome Notifications!",
@@ -47,7 +45,7 @@ export default {
4745
delay: 0
4846
}
4947
},
50-
48+
5149
dismiss: {
5250
duration: 5000
5351
}

0 commit comments

Comments
 (0)