Skip to content

Commit 0335c8c

Browse files
authored
feat: add TuonoLayoutProps interface (#702)
1 parent 0fa83fb commit 0335c8c

File tree

6 files changed

+27
-25
lines changed

6 files changed

+27
-25
lines changed

examples/tuono-app/src/routes/__layout.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
import type { ReactNode, JSX } from 'react'
1+
import type { JSX } from 'react'
22
import { TuonoScripts } from 'tuono'
3+
import type { TuonoLayoutProps } from 'tuono'
34

45
import '../styles/global.css'
56

6-
interface RootLayoutProps {
7-
children: ReactNode
8-
}
9-
10-
export default function RootLayout({ children }: RootLayoutProps): JSX.Element {
7+
export default function RootLayout({
8+
children,
9+
}: TuonoLayoutProps): JSX.Element {
1110
return (
1211
<html>
1312
<body>

examples/tuono-tutorial/src/routes/__layout.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
import type { ReactNode, JSX } from 'react'
1+
import type { JSX } from 'react'
22
import { TuonoScripts } from 'tuono'
3+
import type { TuonoLayoutProps } from 'tuono'
34

45
import '../styles/global.css'
56

6-
interface RootLayoutProps {
7-
children: ReactNode
8-
}
9-
10-
export default function RootLayout({ children }: RootLayoutProps): JSX.Element {
7+
export default function RootLayout({
8+
children,
9+
}: TuonoLayoutProps): JSX.Element {
1110
return (
1211
<html>
1312
<body>

examples/with-mdx/src/routes/__layout.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
import type { ReactNode, JSX } from 'react'
1+
import type { JSX } from 'react'
22
import { MDXProvider } from '@mdx-js/react'
33
import { TuonoScripts } from 'tuono'
4+
import type { TuonoLayoutProps } from 'tuono'
45

56
import '../styles/global.css'
67

7-
interface RootLayoutProps {
8-
children: ReactNode
9-
}
10-
11-
export default function RootLayout({ children }: RootLayoutProps): JSX.Element {
8+
export default function RootLayout({
9+
children,
10+
}: TuonoLayoutProps): JSX.Element {
1211
return (
1312
<html>
1413
<body>

examples/with-tailwind/src/routes/__layout.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
import type { ReactNode, JSX } from 'react'
1+
import type { JSX } from 'react'
22
import { TuonoScripts } from 'tuono'
3+
import type { TuonoLayoutProps } from 'tuono'
34

45
import '../styles/global.css'
56

6-
interface RootLayoutProps {
7-
children: ReactNode
8-
}
9-
10-
export default function RootLayout({ children }: RootLayoutProps): JSX.Element {
7+
export default function RootLayout({
8+
children,
9+
}: TuonoLayoutProps): JSX.Element {
1110
return (
1211
<html>
1312
<head>

packages/tuono/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ export {
1313

1414
export { TuonoScripts } from './shared/TuonoScripts'
1515

16-
export type { TuonoRouteProps } from './types'
16+
export type { TuonoRouteProps, TuonoLayoutProps } from './types'

packages/tuono/src/types.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import type { ReactNode } from 'react'
2+
13
/**
24
* Provided by the rust server and used in the ssr env
35
* @see tuono-router {@link ServerInitialLocation}
@@ -56,3 +58,7 @@ export type TuonoRouteProps<TData> =
5658
data: TData
5759
isLoading: false
5860
}
61+
62+
export interface TuonoLayoutProps {
63+
children: ReactNode
64+
}

0 commit comments

Comments
 (0)