refact: convert components to use React.FC type + type improvements

This commit is contained in:
Phi
2019-09-17 17:06:43 -04:00
committed by Jean-Philippe Sirois
parent d61c218657
commit 1d88367645
23 changed files with 89 additions and 74 deletions
+7 -3
View File
@@ -1,5 +1,5 @@
import { Link } from "gatsby"
import React, { PropsWithChildren, useLayoutEffect, useState } from "react"
import React, { FC, useLayoutEffect, useState } from "react"
import { DiscordButton } from "../DiscordButton"
import { WavesBottom, WavesTop } from "../Waves"
import * as SC from "./styles"
@@ -8,7 +8,11 @@ interface IHeaderProps {
isHome: boolean
}
function MenuItem({ children, to }: PropsWithChildren<{ to: string }>) {
interface IMenuItemProps {
to: string
}
const MenuItem: FC<IMenuItemProps> = ({ children, to }) => {
return (
<SC.MenuItem
to={to}
@@ -21,7 +25,7 @@ function MenuItem({ children, to }: PropsWithChildren<{ to: string }>) {
)
}
export function Header({ isHome }: IHeaderProps) {
export const Header: FC<IHeaderProps> = ({ isHome }) => {
// Hack to force Particle.js to rerender
const [noop, setNoop] = useState(0)
useLayoutEffect(() => {