refactor: use React.JSX rather than global JSX (#93)

This commit is contained in:
Marco Pasqualetti
2024-11-13 08:33:48 +01:00
committed by GitHub
parent 6331eb64e6
commit 7b8165cee6
40 changed files with 79 additions and 40 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
import type { ReactNode } from 'react'
import type { ReactNode, JSX } from 'react'
import { MDXProvider } from '@mdx-js/react'
interface RootRouteProps {
+1 -1
View File
@@ -1,4 +1,4 @@
import type { ReactNode } from 'react'
import type { ReactNode, JSX } from 'react'
interface RootRouteProps {
children: ReactNode
+1
View File
@@ -1,3 +1,4 @@
import type { JSX } from 'react'
import type { TuonoProps } from 'tuono'
interface IndexProps {
@@ -1,4 +1,6 @@
import type { JSX } from 'react'
import { Link } from 'tuono'
import styles from './PokemonLink.module.css'
interface Pokemon {
+1 -1
View File
@@ -1,4 +1,4 @@
import type { ReactNode } from 'react'
import type { ReactNode, JSX } from 'react'
interface RootRouteProps {
children: ReactNode
+4 -2
View File
@@ -1,5 +1,7 @@
// src/routes/index.tsx
import type { JSX } from 'react'
import { Head, type TuonoProps } from 'tuono'
import PokemonLink from '../components/PokemonLink'
interface Pokemon {
@@ -12,9 +14,9 @@ interface IndexProps {
export default function IndexPage({
data,
}: TuonoProps<IndexProps>): JSX.Element {
}: TuonoProps<IndexProps>): JSX.Element | null {
if (!data?.results) {
return <></>
return null
}
return (
@@ -1,22 +1,24 @@
import type { JSX } from 'react'
import { Head, type TuonoProps } from 'tuono'
import PokemonView from '../../components/PokemonView'
interface Pokemon {
name: string
id: string
weight: number
height: number
name: string
id: string
weight: number
height: number
}
export default function PokemonPage({
data,
data,
}: TuonoProps<Pokemon>): JSX.Element {
return (
<>
<Head>
<title>{`Pokemon: ${data?.name}`}</title>
</Head>
<PokemonView pokemon={data} />
</>
)
return (
<>
<Head>
<title>{`Pokemon: ${data?.name}`}</title>
</Head>
<PokemonView pokemon={data} />
</>
)
}