From a69d43af36b25f491d444d46ac141e79e892abdb Mon Sep 17 00:00:00 2001 From: Kichiyaki Date: Tue, 30 Jun 2020 14:21:18 +0200 Subject: [PATCH] add PropTypes to components --- src/components/Layout/Footer.js | 6 ++++++ src/components/Layout/Header.js | 8 ++++++++ src/components/Layout/LanguageSelector.js | 7 +++++++ src/features/CommandsPage/Command.js | 8 ++++++++ src/pages/404.js | 6 +++++- 5 files changed, 34 insertions(+), 1 deletion(-) diff --git a/src/components/Layout/Footer.js b/src/components/Layout/Footer.js index ff80efc..f55a1d3 100644 --- a/src/components/Layout/Footer.js +++ b/src/components/Layout/Footer.js @@ -1,4 +1,5 @@ import React from "react"; +import PropTypes from "prop-types"; import { makeStyles } from "@material-ui/core/styles"; import { AppBar, Toolbar, Typography, Container } from "@material-ui/core"; @@ -45,4 +46,9 @@ function Footer({ title, lang }) { ); } +Footer.propTypes = { + title: PropTypes.string.isRequired, + lang: PropTypes.string.isRequired, +}; + export default Footer; diff --git a/src/components/Layout/Header.js b/src/components/Layout/Header.js index abd81bc..74ff58b 100644 --- a/src/components/Layout/Header.js +++ b/src/components/Layout/Header.js @@ -1,4 +1,5 @@ import React, { useState } from "react"; +import PropTypes from "prop-types"; import routes from "@config/routes"; import { makeStyles } from "@material-ui/core/styles"; @@ -112,4 +113,11 @@ function Header({ twhelpUrl, lang, languages, pathname }) { ); } +Header.propTypes = { + lang: PropTypes.string.isRequired, + twhelpUrl: PropTypes.string.isRequired, + pathname: PropTypes.string.isRequired, + languages: PropTypes.arrayOf(PropTypes.string), +}; + export default Header; diff --git a/src/components/Layout/LanguageSelector.js b/src/components/Layout/LanguageSelector.js index b9cb27d..2f28a1a 100644 --- a/src/components/Layout/LanguageSelector.js +++ b/src/components/Layout/LanguageSelector.js @@ -1,4 +1,5 @@ import React from "react"; +import PropTypes from "prop-types"; import plFlag from "@images/flags/pl.svg"; import usaFlag from "@images/flags/usa.svg"; @@ -60,4 +61,10 @@ function LanguageSelector({ lang, languages, pathname }) { ); } +Header.propTypes = { + lang: PropTypes.string.isRequired, + pathname: PropTypes.string.isRequired, + languages: PropTypes.arrayOf(PropTypes.string), +}; + export default LanguageSelector; diff --git a/src/features/CommandsPage/Command.js b/src/features/CommandsPage/Command.js index 7c57268..0b03a79 100644 --- a/src/features/CommandsPage/Command.js +++ b/src/features/CommandsPage/Command.js @@ -1,4 +1,5 @@ import React from "react"; +import PropTypes from "prop-types"; import { Card, CardHeader, CardContent, Typography } from "@material-ui/core"; @@ -21,4 +22,11 @@ function Command({ command, commandSyntax, description, example }) { ); } +Command.propTypes = { + command: PropTypes.string.isRequired, + commandSyntax: PropTypes.string.isRequired, + description: PropTypes.string.isRequired, + example: PropTypes.string.isRequired, +}; + export default Command; diff --git a/src/pages/404.js b/src/pages/404.js index a6780ac..8b6f97e 100644 --- a/src/pages/404.js +++ b/src/pages/404.js @@ -25,7 +25,11 @@ const NotFoundPage = ({ location, pageContext }) => { lang={pageContext.langKey} pathname={location.pathname} > - + Page Not Found