Skip to content

Commit 7175721

Browse files
committed
refactor: types
1 parent 48ea38b commit 7175721

File tree

5 files changed

+12
-11
lines changed

5 files changed

+12
-11
lines changed

app/layout.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { Metadata } from 'next'
1+
import type { PropsWithChildren, ReactElement } from 'react'
2+
import type { Metadata } from 'next'
23
import './globals.css'
34

45
import { PageTitle } from 'components/PageTitle'
@@ -37,7 +38,7 @@ export const metadata: Metadata = {
3738
},
3839
}
3940

40-
export default function RootLayout({ children }: { children: React.ReactNode }) {
41+
export default function RootLayout({ children }: PropsWithChildren): ReactElement {
4142
return (
4243
<html lang="en" data-theme="dark">
4344
<body className="pt-20">

app/page.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import { Section } from 'components'
1+
import type { ReactElement } from 'react'
2+
import { Section } from 'components/Section'
23

3-
const Page = (): JSX.Element => (
4+
const Page = (): ReactElement => (
45
<Section title="About">
56
<div className="text-base md:text-xl hyphens-auto" itemScope itemType="https://schema.org/Person">
67
<span itemProp="name">Ole-Martin Bratteng</span> &mdash; Software Engineer. Located in the beautiful municipality

components/PageTitle.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22

33
import Link from 'next/link'
44
import { usePathname } from 'next/navigation'
5+
import type { ReactElement } from 'react'
56

6-
const PageTitle = (): JSX.Element => {
7+
const PageTitle = (): ReactElement => {
78
const pathName = usePathname()
89
const subTitle = pathName.substring(1)
910

components/Section.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
import type { ReactNode } from 'react'
1+
import type { PropsWithChildren, ReactElement } from 'react'
22

3-
interface Props {
3+
type Props = {
44
title: string
5-
children: ReactNode
6-
}
5+
} & PropsWithChildren
76

8-
const Section = ({ children, title }: Props): JSX.Element => (
7+
const Section = ({ children, title }: Props): ReactElement => (
98
<section className="flex flex-wrap px-4 mb-8 first-of-type:pt-0 last-of-type:pb-0 last-of-type:mb-0">
109
{title && (
1110
<h2 className="mb-4 w-full text-2xl md:text-3xl">

components/index.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)