From 9daf248d21ebfe3f15ed9d408c37f9bb21dec530 Mon Sep 17 00:00:00 2001 From: tricinel Date: Tue, 17 Oct 2017 10:16:00 +0200 Subject: [PATCH] Move types to separate declaration; related to #24 --- src/components/MarkdownPage/MarkdownPage.js | 24 ++++++++++--------- .../TitleAndMetaTags/TitleAndMetaTags.js | 11 ++++----- src/templates/components/ChevronSvg/index.js | 9 ++++--- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/components/MarkdownPage/MarkdownPage.js b/src/components/MarkdownPage/MarkdownPage.js index 85d82b49..ef166397 100644 --- a/src/components/MarkdownPage/MarkdownPage.js +++ b/src/components/MarkdownPage/MarkdownPage.js @@ -19,6 +19,18 @@ import toCommaSeparatedList from 'utils/toCommaSeparatedList'; import {sharedStyles} from 'theme'; import createOgUrl from 'utils/createOgUrl'; +type Props = { + authors: Array, + createLink: Function, + date?: string, + enableScrollSync?: boolean, + ogDescription: string, + location: Object, + markdownRemark: Object, + sectionList: Array, + titlePostfix: string, +}; + const MarkdownPage = ({ authors = [], createLink, @@ -29,17 +41,7 @@ const MarkdownPage = ({ markdownRemark, sectionList, titlePostfix = '', -}: { - authors: Array, - createLink: Function, - date: string, - enableScrollSync: boolean, - ogDescription: string, - location: Object, - markdownRemark: Object, - sectionList: Array, - titlePostfix: string, -}) => { +}: Props) => { const hasAuthors = authors.length > 0; const titlePrefix = markdownRemark.frontmatter.title || ''; diff --git a/src/components/TitleAndMetaTags/TitleAndMetaTags.js b/src/components/TitleAndMetaTags/TitleAndMetaTags.js index c8d0acb5..5d985060 100644 --- a/src/components/TitleAndMetaTags/TitleAndMetaTags.js +++ b/src/components/TitleAndMetaTags/TitleAndMetaTags.js @@ -2,6 +2,7 @@ * Copyright (c) 2013-present, Facebook, Inc. * * @emails react-core + * @flow */ 'use strict'; @@ -11,15 +12,13 @@ import React from 'react'; const defaultDescription = 'A JavaScript library for building user interfaces'; -const TitleAndMetaTags = ({ - title, - ogDescription, - ogUrl, -}: { +type Props = { title: string, ogDescription: string, ogUrl: string, -}) => { +}; + +const TitleAndMetaTags = ({title, ogDescription, ogUrl}: Props) => { return ( diff --git a/src/templates/components/ChevronSvg/index.js b/src/templates/components/ChevronSvg/index.js index 0be8be29..1e2e77e0 100644 --- a/src/templates/components/ChevronSvg/index.js +++ b/src/templates/components/ChevronSvg/index.js @@ -9,13 +9,12 @@ import React from 'react'; -const ChevronSvg = ({ - size = 10, - cssProps = {}, -}: { +type Props = { size: number, cssProps: Object, -}) => ( +}; + +const ChevronSvg = ({size = 10, cssProps = {}}: Props) => (