Restructures navigation into a components folder and adds Over mij route
Moves AppShell out of src/shared into a top-level components folder alongside the new Footer and NavigationBar, replaces the about page with over-mij.tsx, and drops the unused counter.ts.
This commit is contained in:
@@ -0,0 +1,13 @@
|
|||||||
|
import { Outlet } from '@tanstack/react-router';
|
||||||
|
import NavigationBar from './NavigationBar/NavigationBar';
|
||||||
|
import Footer from './Footer';
|
||||||
|
|
||||||
|
export default function AppShell() {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<NavigationBar />
|
||||||
|
<Outlet />
|
||||||
|
<Footer />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
export default function Footer() {
|
||||||
|
return (
|
||||||
|
<footer className="p-2 text-center">
|
||||||
|
<p className="text-sm text-gray-500">
|
||||||
|
© {new Date().getFullYear()} Andrea Slop Fotografie. All
|
||||||
|
rights reserved.
|
||||||
|
</p>
|
||||||
|
</footer>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
export function setupCounter(element: HTMLButtonElement) {
|
|
||||||
let counter = 0
|
|
||||||
const setCounter = (count: number) => {
|
|
||||||
counter = count
|
|
||||||
element.innerHTML = `Count is ${counter}`
|
|
||||||
}
|
|
||||||
element.addEventListener('click', () => setCounter(counter + 1))
|
|
||||||
setCounter(0)
|
|
||||||
}
|
|
||||||
+17
-17
@@ -10,43 +10,43 @@
|
|||||||
|
|
||||||
import { Route as rootRouteImport } from './routes/__root'
|
import { Route as rootRouteImport } from './routes/__root'
|
||||||
import { Route as IndexRouteImport } from './routes/index'
|
import { Route as IndexRouteImport } from './routes/index'
|
||||||
import { Route as AboutRouteImport } from './routes/about'
|
import { Route as OverMijRouteImport } from './routes/over-mij'
|
||||||
|
|
||||||
const IndexRoute = IndexRouteImport.update({
|
const IndexRoute = IndexRouteImport.update({
|
||||||
id: '/',
|
id: '/',
|
||||||
path: '/',
|
path: '/',
|
||||||
getParentRoute: () => rootRouteImport,
|
getParentRoute: () => rootRouteImport,
|
||||||
} as any)
|
} as any)
|
||||||
const AboutRoute = AboutRouteImport.update({
|
const OverMijRoute = OverMijRouteImport.update({
|
||||||
id: '/about',
|
id: '/over-mij',
|
||||||
path: '/about',
|
path: '/over-mij',
|
||||||
getParentRoute: () => rootRouteImport,
|
getParentRoute: () => rootRouteImport,
|
||||||
} as any)
|
} as any)
|
||||||
|
|
||||||
export interface FileRoutesByFullPath {
|
export interface FileRoutesByFullPath {
|
||||||
'/': typeof IndexRoute
|
'/': typeof IndexRoute
|
||||||
'/about': typeof AboutRoute
|
'/over-mij': typeof OverMijRoute
|
||||||
}
|
}
|
||||||
export interface FileRoutesByTo {
|
export interface FileRoutesByTo {
|
||||||
'/': typeof IndexRoute
|
'/': typeof IndexRoute
|
||||||
'/about': typeof AboutRoute
|
'/over-mij': typeof OverMijRoute
|
||||||
}
|
}
|
||||||
export interface FileRoutesById {
|
export interface FileRoutesById {
|
||||||
__root__: typeof rootRouteImport
|
__root__: typeof rootRouteImport
|
||||||
'/': typeof IndexRoute
|
'/': typeof IndexRoute
|
||||||
'/about': typeof AboutRoute
|
'/over-mij': typeof OverMijRoute
|
||||||
}
|
}
|
||||||
export interface FileRouteTypes {
|
export interface FileRouteTypes {
|
||||||
fileRoutesByFullPath: FileRoutesByFullPath
|
fileRoutesByFullPath: FileRoutesByFullPath
|
||||||
fullPaths: '/' | '/about'
|
fullPaths: '/' | '/over-mij'
|
||||||
fileRoutesByTo: FileRoutesByTo
|
fileRoutesByTo: FileRoutesByTo
|
||||||
to: '/' | '/about'
|
to: '/' | '/over-mij'
|
||||||
id: '__root__' | '/' | '/about'
|
id: '__root__' | '/' | '/over-mij'
|
||||||
fileRoutesById: FileRoutesById
|
fileRoutesById: FileRoutesById
|
||||||
}
|
}
|
||||||
export interface RootRouteChildren {
|
export interface RootRouteChildren {
|
||||||
IndexRoute: typeof IndexRoute
|
IndexRoute: typeof IndexRoute
|
||||||
AboutRoute: typeof AboutRoute
|
OverMijRoute: typeof OverMijRoute
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module '@tanstack/react-router' {
|
declare module '@tanstack/react-router' {
|
||||||
@@ -58,11 +58,11 @@ declare module '@tanstack/react-router' {
|
|||||||
preLoaderRoute: typeof IndexRouteImport
|
preLoaderRoute: typeof IndexRouteImport
|
||||||
parentRoute: typeof rootRouteImport
|
parentRoute: typeof rootRouteImport
|
||||||
}
|
}
|
||||||
'/about': {
|
'/over-mij': {
|
||||||
id: '/about'
|
id: '/over-mij'
|
||||||
path: '/about'
|
path: '/over-mij'
|
||||||
fullPath: '/about'
|
fullPath: '/over-mij'
|
||||||
preLoaderRoute: typeof AboutRouteImport
|
preLoaderRoute: typeof OverMijRouteImport
|
||||||
parentRoute: typeof rootRouteImport
|
parentRoute: typeof rootRouteImport
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -70,7 +70,7 @@ declare module '@tanstack/react-router' {
|
|||||||
|
|
||||||
const rootRouteChildren: RootRouteChildren = {
|
const rootRouteChildren: RootRouteChildren = {
|
||||||
IndexRoute: IndexRoute,
|
IndexRoute: IndexRoute,
|
||||||
AboutRoute: AboutRoute,
|
OverMijRoute: OverMijRoute,
|
||||||
}
|
}
|
||||||
export const routeTree = rootRouteImport
|
export const routeTree = rootRouteImport
|
||||||
._addFileChildren(rootRouteChildren)
|
._addFileChildren(rootRouteChildren)
|
||||||
|
|||||||
@@ -1,20 +1,12 @@
|
|||||||
import { createRootRoute, Link, Outlet } from '@tanstack/react-router'
|
import { createRootRoute } from "@tanstack/react-router";
|
||||||
import { TanStackRouterDevtools } from '@tanstack/react-router-devtools'
|
import { TanStackRouterDevtools } from "@tanstack/react-router-devtools";
|
||||||
|
import AppShell from "../../components/AppShell";
|
||||||
|
|
||||||
const RootLayout = () => (
|
const RootLayout = () => (
|
||||||
<>
|
<>
|
||||||
<div className="p-2 flex gap-2">
|
<AppShell />
|
||||||
<Link to="/" className="[&.active]:font-bold">
|
|
||||||
Home
|
|
||||||
</Link>{' '}
|
|
||||||
<Link to="/about" className="[&.active]:font-bold">
|
|
||||||
About
|
|
||||||
</Link>
|
|
||||||
</div>
|
|
||||||
<hr />
|
|
||||||
<Outlet />
|
|
||||||
<TanStackRouterDevtools />
|
<TanStackRouterDevtools />
|
||||||
</>
|
</>
|
||||||
)
|
);
|
||||||
|
|
||||||
export const Route = createRootRoute({ component: RootLayout })
|
export const Route = createRootRoute({ component: RootLayout });
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
import { createFileRoute } from '@tanstack/react-router'
|
|
||||||
|
|
||||||
export const Route = createFileRoute('/about')({
|
|
||||||
component: About,
|
|
||||||
})
|
|
||||||
|
|
||||||
function About() {
|
|
||||||
return <div className="p-2">Hello from About!</div>
|
|
||||||
}
|
|
||||||
@@ -1,13 +1,14 @@
|
|||||||
import { createFileRoute } from '@tanstack/react-router'
|
import { Heading } from '@chakra-ui/react';
|
||||||
|
import { createFileRoute } from '@tanstack/react-router';
|
||||||
|
|
||||||
export const Route = createFileRoute('/')({
|
export const Route = createFileRoute('/')({
|
||||||
component: Index,
|
component: Index,
|
||||||
})
|
});
|
||||||
|
|
||||||
function Index() {
|
function Index() {
|
||||||
return (
|
return (
|
||||||
<div className="p-2">
|
<div className="p-2">
|
||||||
<h3>Welcome Home!</h3>
|
<Heading>Welcome Home!</Heading>
|
||||||
</div>
|
</div>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
import { createFileRoute } from "@tanstack/react-router";
|
||||||
|
|
||||||
|
export const Route = createFileRoute("/over-mij")({
|
||||||
|
component: About,
|
||||||
|
});
|
||||||
|
|
||||||
|
function About() {
|
||||||
|
return <div className="p-2">Hello from About!</div>;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user