From 2ca22419ec95ca45f6b25ab0e567d72f0d6920b5 Mon Sep 17 00:00:00 2001 From: Roman Timashev Date: Thu, 17 Oct 2019 17:05:48 +0300 Subject: [PATCH] Meta component refactoring + typing --- src/components/{Meta.jsx => Meta/index.tsx} | 19 ++++++++++++------- src/types.ts | 16 ++++++++++++++++ 2 files changed, 28 insertions(+), 7 deletions(-) rename src/components/{Meta.jsx => Meta/index.tsx} (87%) diff --git a/src/components/Meta.jsx b/src/components/Meta/index.tsx similarity index 87% rename from src/components/Meta.jsx rename to src/components/Meta/index.tsx index 378b1f4c..102936eb 100644 --- a/src/components/Meta.jsx +++ b/src/components/Meta/index.tsx @@ -1,7 +1,12 @@ -import React from 'react' +import * as React from 'react' +import { IMeta } from '../../types' -export const Meta = ({ meta }) => ( - +export interface IMetaProps { + meta: IMeta +} + +export const Meta: React.FC = ({ meta }) => ( + <> {/* Search Engine */} @@ -15,8 +20,8 @@ export const Meta = ({ meta }) => ( - - + + @@ -31,5 +36,5 @@ export const Meta = ({ meta }) => ( - -) \ No newline at end of file + +) diff --git a/src/types.ts b/src/types.ts index cd3580e1..7bd31cff 100644 --- a/src/types.ts +++ b/src/types.ts @@ -7,3 +7,19 @@ export interface IDocument { title: string url: string } + +export interface IMeta { + url: string + siteName: string + locale: string + type: string + description: string + domain: string + title: string + image: string + imageWidth: number + imageHeight: number + twitterCard: string + twitterSite: string + twitterCreator: string +}