From 065ebd57cd9da8e9e6c74152f7ab1200d6a6d013 Mon Sep 17 00:00:00 2001 From: Michal Sapka Date: Sun, 4 Sep 2022 22:34:11 +0200 Subject: feat: add missing types --- components/layout.tsx | 8 +++++++- components/topnav.tsx | 7 ++++++- data/publications.tsx | 2 +- lib/theme.tsx | 10 ++++++---- pages/_app.tsx | 2 +- pages/index.tsx | 7 ++++++- 6 files changed, 27 insertions(+), 9 deletions(-) diff --git a/components/layout.tsx b/components/layout.tsx index b3506ea..f137cb4 100644 --- a/components/layout.tsx +++ b/components/layout.tsx @@ -1,6 +1,12 @@ import TopNav from '../components/topnav' import { Container, Box } from '@chakra-ui/react' -export default function Layout({ children }) { +import ReactNode from 'react' + +type Props = { + children?: any +} + +export default function Layout({ children } : Props) { return ( <> diff --git a/components/topnav.tsx b/components/topnav.tsx index 3e729ba..a46f38f 100644 --- a/components/topnav.tsx +++ b/components/topnav.tsx @@ -19,7 +19,12 @@ import { import { GiHamburgerMenu } from "react-icons/gi" import { DiGithubBadge } from "react-icons/di" -function NavLink({to, children}) { +type NavLinkType = { + to: string, + children: any, +} + +function NavLink({to, children} : NavLinkType) { return {children} diff --git a/data/publications.tsx b/data/publications.tsx index 099841d..b764957 100644 --- a/data/publications.tsx +++ b/data/publications.tsx @@ -1,4 +1,4 @@ -type Publications = { +type Publication = { name: string, url: string, } diff --git a/lib/theme.tsx b/lib/theme.tsx index 08f269f..8b65ac2 100644 --- a/lib/theme.tsx +++ b/lib/theme.tsx @@ -1,21 +1,23 @@ import { extendTheme } from "@chakra-ui/react" import { mode } from '@chakra-ui/theme-tools' +type propsType = any + const styles = { - global: props => ({ + global: (props : propsType) => { body: { //bg: mode('#d5d6db', '#24283b')(props), //color: mode('#0f4b6e', '#7dcfff')(props), } - }) + } } const components = { Link: { - baseStyle: props => ({ + baseStyle: (props : propsType) => { //color: mode('#34548a', '##34548a')(props), textUnderlineOffset: 3 - }) + } }, Heading: { baseStyle: { diff --git a/pages/_app.tsx b/pages/_app.tsx index 1c06149..da7cb05 100644 --- a/pages/_app.tsx +++ b/pages/_app.tsx @@ -1,5 +1,5 @@ import { ChakraProvider } from '@chakra-ui/react' -import theme from '../lib/theme.tsx' +import theme from '../lib/theme' import type { AppProps } from 'next/app' import '@fontsource/lato/400.css' diff --git a/pages/index.tsx b/pages/index.tsx index 1212d08..4477d0b 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -18,7 +18,12 @@ import { import { AiFillGithub,AiFillMediumCircle} from "react-icons/ai"; import Publications from "../data/publications" -const BioEntry = ({date, description}) => { +type BioEntryType = { + date: string, + description: string +} + +const BioEntry = ({date, description} : BioEntryType) => { return {date} {description} -- cgit v1.2.3