@molebox/add-interfaces: removed propTypes and added interfaces

This commit is contained in:
Richard Haines
2019-12-17 15:50:23 +01:00
parent bdd79383b5
commit d7d42f3ff1
3 changed files with 34 additions and 30 deletions

View File

@@ -1,10 +1,13 @@
import { Link } from 'gatsby';
import PropTypes from 'prop-types';
import React from 'react';
import { Text, View } from 'react-native';
import { useREM } from 'react-native-web-hooks';
const Header = ({ siteTitle }) => {
interface Props {
siteTitle: string;
}
const Header = ({ siteTitle = '' }: Props) => {
const accessibilityRole: any = 'banner'
return (
@@ -37,12 +40,5 @@ const Header = ({ siteTitle }) => {
</View>
)
}
Header.propTypes = {
siteTitle: PropTypes.string,
}
Header.defaultProps = {
siteTitle: ``,
}
export default Header

View File

@@ -5,17 +5,20 @@
* See: https://www.gatsbyjs.org/docs/use-static-query/
*/
import { graphql, useStaticQuery } from 'gatsby';
import PropTypes from 'prop-types';
import React from 'react';
import { Text, View } from 'react-native';
interface Props {
children: React.ReactNode;
}
import Header from './header';
const Anchor = (props: any) => {
return <Text accessibilityRole="link" {...props} />
}
const Layout = ({ children }) => {
const Layout = ({ children }: Props) => {
const data = useStaticQuery(graphql`
query SiteTitleQuery {
site {
@@ -49,8 +52,4 @@ const Layout = ({ children }) => {
)
}
Layout.propTypes = {
children: PropTypes.node.isRequired,
}
export default Layout

View File

@@ -5,12 +5,34 @@
* See: https://www.gatsbyjs.org/docs/use-static-query/
*/
import { graphql, useStaticQuery } from 'gatsby';
import PropTypes from 'prop-types';
import React from 'react';
import Helmet from 'react-helmet';
interface Props {
title: string;
meta?: ConcatArray<Meta>;
lang?: string;
description?: string;
}
function SEO({ description, lang, meta, title }) {
type Meta = MetaContent | MetaProperty;
type MetaContent = {
property?: undefined;
content: any;
name: string;
}
type MetaProperty = {
property: string;
content: any;
name?: undefined;
}
function SEO({ description = '', lang = 'en', meta = [], title }: Props) {
const { site } = useStaticQuery(
graphql`
query {
@@ -72,17 +94,4 @@ function SEO({ description, lang, meta, title }) {
)
}
SEO.defaultProps = {
lang: `en`,
meta: [],
description: ``,
}
SEO.propTypes = {
description: PropTypes.string,
lang: PropTypes.string,
meta: PropTypes.arrayOf(PropTypes.object),
title: PropTypes.string.isRequired,
}
export default SEO