Skip to content
Source
Sign inSign up
TanStack/router
Open History to see the last commit

SharedNestedLayout.tsx

31 lines899 Bytes

1/// <reference types="vite/client" />
2import { Link, linkOptions } from '@tanstack/solid-router'
3import styles from '~/styles/shared-layout.module.css'
4​
5const ROUTES = linkOptions([
6 { to: '/shared-a', label: '/shared-a' },
7 { to: '/shared-b', label: '/shared-b' },
8 { to: '/shared-c', label: '/shared-c' },
9])
10​
11export function SharedNestedLayout(props: { children?: any }) {
12 return (
13 <section class={styles.layout} data-testid="shared-layout-shell">
14 <div class={styles.heading} data-testid="shared-layout-heading">
15 Shared nested layout CSS
16 </div>
17​
18 <nav class={styles.nav}>
19 {ROUTES.map((route) => (
20 <Link {...route} data-testid={`nav-${route.label}`}>
21 {route.label}
22 </Link>
23 ))}
24 </nav>
25​
26 <div class={styles.body} data-testid="shared-layout-copy">
27 {props.children}
28 </div>
29 </section>
30 )