diff --git a/src/components/CircleIcon/CircleIcon.js b/src/components/CircleIcon/CircleIcon.js index b085ba23..9280047e 100644 --- a/src/components/CircleIcon/CircleIcon.js +++ b/src/components/CircleIcon/CircleIcon.js @@ -1,7 +1,11 @@ import React from "react"; - +import PropTypes from "prop-types"; import "./CircleIcon.scss"; export default function CircleIcon({ children }) { return
{children}
; } + +CircleIcon.propTypes = { + children: PropTypes.node +}; diff --git a/src/components/FAQ/FAQ.js b/src/components/FAQ/FAQ.js index 47ce632f..066dbef6 100644 --- a/src/components/FAQ/FAQ.js +++ b/src/components/FAQ/FAQ.js @@ -1,5 +1,5 @@ import React from "react"; - +import PropTypes from "prop-types"; import "./FAQ.scss"; export default function FAQ({ title, children }) { @@ -13,3 +13,8 @@ export default function FAQ({ title, children }) { ); } + +FAQ.propTypes = { + title: PropTypes.string, + children: PropTypes.node +}; diff --git a/src/components/HomeNetwork/HomeNetwork.js b/src/components/HomeNetwork/HomeNetwork.js index 7ce3ea76..61acde1c 100644 --- a/src/components/HomeNetwork/HomeNetwork.js +++ b/src/components/HomeNetwork/HomeNetwork.js @@ -142,8 +142,8 @@ export default function HomeNetwork() {

- Skynet's speeds rival centralized providers and surpass all decentralized offerings. A typical Skynet - download starts in under 500 ms and can stream at rates as high as 1 Gbps! + Skynet's speeds rival centralized providers and surpass all decentralized offerings. A typical + Skynet download starts in under 500 ms and can stream at rates as high as 1 Gbps! { ); }; +CustomForm.propTypes = { + status: PropTypes.string, + message: PropTypes.string, + onValidated: PropTypes.func, + light: PropTypes.bool, + id: PropTypes.string +}; + export default function Mailing({ light, id }) { return ( ); } + +Mailing.propTypes = { + light: PropTypes.bool, + id: PropTypes.string +}; diff --git a/src/components/Sample/Sample.js b/src/components/Sample/Sample.js index 71bf40c7..cada25d2 100644 --- a/src/components/Sample/Sample.js +++ b/src/components/Sample/Sample.js @@ -1,6 +1,6 @@ import React from "react"; +import PropTypes from "prop-types"; import classNames from "classnames"; - import "./Sample.scss"; import { Download } from "../../svg"; @@ -17,3 +17,9 @@ export default function Sample({ type, url, className }) { ); } + +Sample.propTypes = { + type: PropTypes.string, + url: PropTypes.string, + className: PropTypes.string +}; diff --git a/src/components/SocialLink/SocialLink.js b/src/components/SocialLink/SocialLink.js index 9c4ddea6..57cf78d3 100644 --- a/src/components/SocialLink/SocialLink.js +++ b/src/components/SocialLink/SocialLink.js @@ -1,5 +1,5 @@ import React from "react"; - +import PropTypes from "prop-types"; import "./SocialLink.scss"; import { Github, Discord, Twitter } from "../../svg"; @@ -24,3 +24,10 @@ export default function SocialLink({ icon, title, greenText, url }) { ); } + +SocialLink.propTypes = { + icon: PropTypes.string, + title: PropTypes.node, + greenText: PropTypes.string, + url: PropTypes.string +}; diff --git a/src/components/UploadFile/UploadFile.js b/src/components/UploadFile/UploadFile.js index 2af62fa5..ada44632 100644 --- a/src/components/UploadFile/UploadFile.js +++ b/src/components/UploadFile/UploadFile.js @@ -1,17 +1,23 @@ -import React, { Component } from "react"; - +import React, { useState, useRef, useEffect } from "react"; import "./UploadFile.scss"; import { LoadingSpinner } from "../"; import { File, FileCheck, FileError, Copy } from "../../svg"; -export default class UploadFile extends Component { - state = { - copied: false - }; +export default function UploadFile({ file, url, status }) { + const [copied, setCopied] = useState(false); + const urlRef = useRef(null); - getIcon = () => { - const { status } = this.props; + useEffect(() => { + if (copied) { + const timeoutId = setTimeout(() => { + setCopied(false); + }, 1500); + return () => clearTimeout(timeoutId); + } + }, [copied, setCopied]); + + const getIcon = () => { if (status === "uploading" || status === "processing") { return ; } else if (status === "error") { @@ -21,56 +27,47 @@ export default class UploadFile extends Component { } }; - copyToClipboard = e => { - this.urlRef.current.select(); + const copyToClipboard = e => { + urlRef.current.select(); document.execCommand("copy"); e.target.focus(); - - this.setState({ copied: true }, () => { - setTimeout(() => { - this.setState({ copied: false }); - }, 1500); - }); + setCopied(true); }; - 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 ( -

-
{this.getIcon()}
-
-

{file.name}

-

- {status === "uploading" && "Uploading..."} - {status === "processing" && "Processing..."} - {status === "error" && Error processing file.} - {status === "complete" && ( - - {url} - - )} -

-
- {(status === "uploading" || status === "processing") && ( -
- -
- )} - - {status === "complete" && ( -