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,56 +27,47 @@ 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() { return (
const { file, url, status } = this.props; <div className="upload-file">
const copyText = this.state.copied ? "Copied!" : "Copy to clipboard"; <div className="upload-file-icon">{getIcon()}</div>
return ( <div className="upload-file-text">
<div className="upload-file"> <h3>{file.name}</h3>
<div className="upload-file-icon">{this.getIcon()}</div> <p>
<div className="upload-file-text"> {status === "uploading" && "Uploading..."}
<h3>{file.name}</h3> {status === "processing" && "Processing..."}
<p> {status === "error" && <span className="red-text">Error processing file.</span>}
{status === "uploading" && "Uploading..."} {status === "complete" && (
{status === "processing" && "Processing..."} <a href={url} className="url green-text">
{status === "error" && <span className="red-text">Error processing file.</span>} {url}
{status === "complete" && ( </a>
<a href={url} className="url green-text"> )}
{url} </p>
</a>
)}
</p>
</div>
{(status === "uploading" || status === "processing") && (
<div className="upload-file-loading">
<LoadingSpinner />
</div>
)}
{status === "complete" && (
<button onClick={this.copyToClipboard} className="upload-file-copy">
<p className="upload-file-copy-tooltip">{copyText}</p>
<div className="upload-file-copy-button">
Copy Link
<Copy />
</div>
<textarea value={url} ref={this.urlRef} readOnly={true} />
</button>
)}
</div> </div>
); {(status === "uploading" || status === "processing") && (
} <div className="upload-file-loading">
<LoadingSpinner />
</div>
)}
{status === "complete" && (
<button onClick={copyToClipboard} className="upload-file-copy">
<p className="upload-file-copy-tooltip">{copyText}</p>
<div className="upload-file-copy-button">
Copy Link
<Copy />
</div>
<textarea value={url} ref={urlRef} readOnly={true} />
</button>
)}
</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 }) {
<LocationContext.Provider value={location}> return (
<SEO /> <LocationContext.Provider value={location}>
<App /> <SEO />
</LocationContext.Provider> <App />
); </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
};