fix eslint validation issues

This commit is contained in:
Karol Wypchlo 2020-02-28 12:30:27 +01:00
parent f4c0f8e020
commit 0eafab8e0c
19 changed files with 160 additions and 68 deletions

View File

@ -1,7 +1,11 @@
import React from "react"; import React from "react";
import PropTypes from "prop-types";
import "./CircleIcon.scss"; import "./CircleIcon.scss";
export default function CircleIcon({ children }) { export default function CircleIcon({ children }) {
return <div className="circle-icon">{children}</div>; return <div className="circle-icon">{children}</div>;
} }
CircleIcon.propTypes = {
children: PropTypes.node
};

View File

@ -1,5 +1,5 @@
import React from "react"; import React from "react";
import PropTypes from "prop-types";
import "./FAQ.scss"; import "./FAQ.scss";
export default function FAQ({ title, children }) { export default function FAQ({ title, children }) {
@ -13,3 +13,8 @@ export default function FAQ({ title, children }) {
</div> </div>
); );
} }
FAQ.propTypes = {
title: PropTypes.string,
children: PropTypes.node
};

View File

@ -142,8 +142,8 @@ export default function HomeNetwork() {
<Fade duration={700} distance="40px" bottom> <Fade duration={700} distance="40px" bottom>
<FAQ title="How fast is Skynet?"> <FAQ title="How fast is Skynet?">
<p> <p>
Skynet's speeds rival centralized providers and surpass all decentralized offerings. A typical Skynet Skynet&apos;s speeds rival centralized providers and surpass all decentralized offerings. A typical
download starts in under 500 ms and can stream at rates as high as 1 Gbps! Skynet download starts in under 500 ms and can stream at rates as high as 1 Gbps!
<a <a
href="https://skynet.helpdocs.io/article/430teoxgqc-skynet-speed" href="https://skynet.helpdocs.io/article/430teoxgqc-skynet-speed"
target="_blank" target="_blank"

View File

@ -1,7 +1,7 @@
import React from "react"; import React from "react";
import PropTypes from "prop-types";
import MailchimpSubscribe from "react-mailchimp-subscribe"; import MailchimpSubscribe from "react-mailchimp-subscribe";
import classNames from "classnames"; import classNames from "classnames";
import "./Mailing.scss"; import "./Mailing.scss";
const url = "https://tech.us11.list-manage.com/subscribe/post?u=5df238d9e852f9801b5f2c92e&amp;id=ab6bea4cc2"; const url = "https://tech.us11.list-manage.com/subscribe/post?u=5df238d9e852f9801b5f2c92e&amp;id=ab6bea4cc2";
@ -45,6 +45,14 @@ const CustomForm = ({ status, message, onValidated, light, id }) => {
); );
}; };
CustomForm.propTypes = {
status: PropTypes.string,
message: PropTypes.string,
onValidated: PropTypes.func,
light: PropTypes.bool,
id: PropTypes.string
};
export default function Mailing({ light, id }) { export default function Mailing({ light, id }) {
return ( return (
<MailchimpSubscribe <MailchimpSubscribe
@ -61,3 +69,8 @@ export default function Mailing({ light, id }) {
/> />
); );
} }
Mailing.propTypes = {
light: PropTypes.bool,
id: PropTypes.string
};

View File

@ -1,6 +1,6 @@
import React from "react"; import React from "react";
import PropTypes from "prop-types";
import classNames from "classnames"; import classNames from "classnames";
import "./Sample.scss"; import "./Sample.scss";
import { Download } from "../../svg"; import { Download } from "../../svg";
@ -17,3 +17,9 @@ export default function Sample({ type, url, className }) {
</div> </div>
); );
} }
Sample.propTypes = {
type: PropTypes.string,
url: PropTypes.string,
className: PropTypes.string
};

View File

@ -1,5 +1,5 @@
import React from "react"; import React from "react";
import PropTypes from "prop-types";
import "./SocialLink.scss"; import "./SocialLink.scss";
import { Github, Discord, Twitter } from "../../svg"; import { Github, Discord, Twitter } from "../../svg";
@ -24,3 +24,10 @@ export default function SocialLink({ icon, title, greenText, url }) {
</a> </a>
); );
} }
SocialLink.propTypes = {
icon: PropTypes.string,
title: PropTypes.node,
greenText: PropTypes.string,
url: PropTypes.string
};

View File

@ -1,17 +1,23 @@
import React, { Component } from "react"; import React, { useState, useRef, useEffect } from "react";
import "./UploadFile.scss"; import "./UploadFile.scss";
import { LoadingSpinner } from "../"; import { LoadingSpinner } from "../";
import { File, FileCheck, FileError, Copy } from "../../svg"; import { File, FileCheck, FileError, Copy } from "../../svg";
export default class UploadFile extends Component { export default function UploadFile({ file, url, status }) {
state = { const [copied, setCopied] = useState(false);
copied: false const urlRef = useRef(null);
};
getIcon = () => { useEffect(() => {
const { status } = this.props; if (copied) {
const timeoutId = setTimeout(() => {
setCopied(false);
}, 1500);
return () => clearTimeout(timeoutId);
}
}, [copied, setCopied]);
const getIcon = () => {
if (status === "uploading" || status === "processing") { if (status === "uploading" || status === "processing") {
return <File />; return <File />;
} else if (status === "error") { } else if (status === "error") {
@ -21,26 +27,18 @@ export default class UploadFile extends Component {
} }
}; };
copyToClipboard = e => { const copyToClipboard = e => {
this.urlRef.current.select(); urlRef.current.select();
document.execCommand("copy"); document.execCommand("copy");
e.target.focus(); e.target.focus();
setCopied(true);
this.setState({ copied: true }, () => {
setTimeout(() => {
this.setState({ copied: false });
}, 1500);
});
}; };
urlRef = React.createRef(); const copyText = copied ? "Copied!" : "Copy to clipboard";
render() {
const { file, url, status } = this.props;
const copyText = this.state.copied ? "Copied!" : "Copy to clipboard";
return ( return (
<div className="upload-file"> <div className="upload-file">
<div className="upload-file-icon">{this.getIcon()}</div> <div className="upload-file-icon">{getIcon()}</div>
<div className="upload-file-text"> <div className="upload-file-text">
<h3>{file.name}</h3> <h3>{file.name}</h3>
<p> <p>
@ -61,16 +59,15 @@ export default class UploadFile extends Component {
)} )}
{status === "complete" && ( {status === "complete" && (
<button onClick={this.copyToClipboard} className="upload-file-copy"> <button onClick={copyToClipboard} className="upload-file-copy">
<p className="upload-file-copy-tooltip">{copyText}</p> <p className="upload-file-copy-tooltip">{copyText}</p>
<div className="upload-file-copy-button"> <div className="upload-file-copy-button">
Copy Link Copy Link
<Copy /> <Copy />
</div> </div>
<textarea value={url} ref={this.urlRef} readOnly={true} /> <textarea value={url} ref={urlRef} readOnly={true} />
</button> </button>
)} )}
</div> </div>
); );
}
} }

View File

@ -1,14 +1,19 @@
import React from "react"; import React from "react";
import PropTypes from "prop-types";
import SEO from "../components/seo"; import SEO from "../components/seo";
import { App } from "../components"; import { App } from "../components";
import "../global.scss"; import "../global.scss";
import LocationContext from "../LocationContext"; import LocationContext from "../LocationContext";
const IndexPage = ({ location }) => ( export default function IndexPage({ location }) {
return (
<LocationContext.Provider value={location}> <LocationContext.Provider value={location}>
<SEO /> <SEO />
<App /> <App />
</LocationContext.Provider> </LocationContext.Provider>
); );
}
export default IndexPage; IndexPage.propTypes = {
location: PropTypes.object.isRequired
};

View File

@ -1,4 +1,5 @@
import React from "react"; import React from "react";
import PropTypes from "prop-types";
export default function Arrow({ className }) { export default function Arrow({ className }) {
return ( return (
@ -7,3 +8,7 @@ export default function Arrow({ className }) {
</svg> </svg>
); );
} }
Arrow.propTypes = {
className: PropTypes.string
};

View File

@ -1,4 +1,5 @@
import React from "react"; import React from "react";
import PropTypes from "prop-types";
export default function Cylinder({ className }) { export default function Cylinder({ className }) {
return ( return (
@ -14,3 +15,7 @@ export default function Cylinder({ className }) {
</svg> </svg>
); );
} }
Cylinder.propTypes = {
className: PropTypes.string
};

View File

@ -1,4 +1,5 @@
import React from "react"; import React from "react";
import PropTypes from "prop-types";
export default function Discord({ className }) { export default function Discord({ className }) {
return ( return (
@ -11,3 +12,7 @@ export default function Discord({ className }) {
</svg> </svg>
); );
} }
Discord.propTypes = {
className: PropTypes.string
};

View File

@ -1,4 +1,5 @@
import React from "react"; import React from "react";
import PropTypes from "prop-types";
export default function DoubleRight({ className }) { export default function DoubleRight({ className }) {
return ( return (
@ -14,3 +15,7 @@ export default function DoubleRight({ className }) {
</svg> </svg>
); );
} }
DoubleRight.propTypes = {
className: PropTypes.string
};

View File

@ -1,4 +1,5 @@
import React from "react"; import React from "react";
import PropTypes from "prop-types";
export default function Download({ className }) { export default function Download({ className }) {
return ( return (
@ -21,3 +22,7 @@ export default function Download({ className }) {
</svg> </svg>
); );
} }
Download.propTypes = {
className: PropTypes.string
};

View File

@ -1,4 +1,5 @@
import React from "react"; import React from "react";
import PropTypes from "prop-types";
export default function Github({ className }) { export default function Github({ className }) {
return ( return (
@ -11,3 +12,7 @@ export default function Github({ className }) {
</svg> </svg>
); );
} }
Github.propTypes = {
className: PropTypes.string
};

View File

@ -1,4 +1,5 @@
import React from "react"; import React from "react";
import PropTypes from "prop-types";
export default function Logo({ className }) { export default function Logo({ className }) {
return ( return (
@ -13,3 +14,7 @@ export default function Logo({ className }) {
</svg> </svg>
); );
} }
Logo.propTypes = {
className: PropTypes.string
};

View File

@ -1,4 +1,5 @@
import React from "react"; import React from "react";
import PropTypes from "prop-types";
export default function LogoSolid({ className }) { export default function LogoSolid({ className }) {
return ( return (
@ -11,3 +12,7 @@ export default function LogoSolid({ className }) {
</svg> </svg>
); );
} }
LogoSolid.propTypes = {
className: PropTypes.string
};

View File

@ -1,4 +1,5 @@
import React from "react"; import React from "react";
import PropTypes from "prop-types";
export default function Pyramid({ className }) { export default function Pyramid({ className }) {
return ( return (
@ -15,3 +16,7 @@ export default function Pyramid({ className }) {
</svg> </svg>
); );
} }
Pyramid.propTypes = {
className: PropTypes.string
};

View File

@ -1,4 +1,5 @@
import React from "react"; import React from "react";
import PropTypes from "prop-types";
export default function SmallOrb({ className }) { export default function SmallOrb({ className }) {
return ( return (
@ -14,3 +15,7 @@ export default function SmallOrb({ className }) {
</svg> </svg>
); );
} }
SmallOrb.propTypes = {
className: PropTypes.string
};

View File

@ -1,4 +1,5 @@
import React from "react"; import React from "react";
import PropTypes from "prop-types";
export default function Twitter({ className }) { export default function Twitter({ className }) {
return ( return (
@ -11,3 +12,7 @@ export default function Twitter({ className }) {
</svg> </svg>
); );
} }
Twitter.propTypes = {
className: PropTypes.string
};