diff --git a/.vscode/launch.json b/.vscode/launch.json
new file mode 100644
index 0000000..99cf789
--- /dev/null
+++ b/.vscode/launch.json
@@ -0,0 +1,22 @@
+{
+ // Use IntelliSense to learn about possible attributes.
+ // Hover to view descriptions of existing attributes.
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
+ "version": "0.2.0",
+ "configurations": [
+ {
+ "type": "chrome",
+ "request": "launch",
+ "name": "Launch Chrome against localhost",
+ "url": "http://localhost:3000",
+ "webRoot": "${workspaceFolder}"
+ },
+ {
+ "type": "msedge",
+ "request": "launch",
+ "name": "Launch Edge against localhost",
+ "url": "http://localhost:3000",
+ "webRoot": "${workspaceFolder}"
+ }
+ ]
+}
diff --git a/src/components/planes/stepper.tsx b/src/components/planes/exampleStepper.tsx
similarity index 100%
rename from src/components/planes/stepper.tsx
rename to src/components/planes/exampleStepper.tsx
diff --git a/src/routeTree.gen.ts b/src/routeTree.gen.ts
index d66293f..0222f41 100644
--- a/src/routeTree.gen.ts
+++ b/src/routeTree.gen.ts
@@ -9,6 +9,7 @@
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
import { Route as rootRouteImport } from './routes/__root'
+import { Route as StepperRouteImport } from './routes/stepper'
import { Route as LoginRouteImport } from './routes/login'
import { Route as DashboardRouteImport } from './routes/dashboard'
import { Route as IndexRouteImport } from './routes/index'
@@ -17,6 +18,11 @@ import { Route as PlanesListaRouteRouteImport } from './routes/planes/_lista/rou
import { Route as PlanesPlanIdRouteRouteImport } from './routes/planes/$planId/route'
import { Route as PlanesListaNuevoRouteImport } from './routes/planes/_lista/nuevo'
+const StepperRoute = StepperRouteImport.update({
+ id: '/stepper',
+ path: '/stepper',
+ getParentRoute: () => rootRouteImport,
+} as any)
const LoginRoute = LoginRouteImport.update({
id: '/login',
path: '/login',
@@ -57,6 +63,7 @@ export interface FileRoutesByFullPath {
'/': typeof IndexRoute
'/dashboard': typeof DashboardRoute
'/login': typeof LoginRoute
+ '/stepper': typeof StepperRoute
'/planes/$planId': typeof PlanesPlanIdRouteRoute
'/planes': typeof PlanesListaRouteRouteWithChildren
'/demo/tanstack-query': typeof DemoTanstackQueryRoute
@@ -66,6 +73,7 @@ export interface FileRoutesByTo {
'/': typeof IndexRoute
'/dashboard': typeof DashboardRoute
'/login': typeof LoginRoute
+ '/stepper': typeof StepperRoute
'/planes/$planId': typeof PlanesPlanIdRouteRoute
'/planes': typeof PlanesListaRouteRouteWithChildren
'/demo/tanstack-query': typeof DemoTanstackQueryRoute
@@ -76,6 +84,7 @@ export interface FileRoutesById {
'/': typeof IndexRoute
'/dashboard': typeof DashboardRoute
'/login': typeof LoginRoute
+ '/stepper': typeof StepperRoute
'/planes/$planId': typeof PlanesPlanIdRouteRoute
'/planes/_lista': typeof PlanesListaRouteRouteWithChildren
'/demo/tanstack-query': typeof DemoTanstackQueryRoute
@@ -87,6 +96,7 @@ export interface FileRouteTypes {
| '/'
| '/dashboard'
| '/login'
+ | '/stepper'
| '/planes/$planId'
| '/planes'
| '/demo/tanstack-query'
@@ -96,6 +106,7 @@ export interface FileRouteTypes {
| '/'
| '/dashboard'
| '/login'
+ | '/stepper'
| '/planes/$planId'
| '/planes'
| '/demo/tanstack-query'
@@ -105,6 +116,7 @@ export interface FileRouteTypes {
| '/'
| '/dashboard'
| '/login'
+ | '/stepper'
| '/planes/$planId'
| '/planes/_lista'
| '/demo/tanstack-query'
@@ -115,6 +127,7 @@ export interface RootRouteChildren {
IndexRoute: typeof IndexRoute
DashboardRoute: typeof DashboardRoute
LoginRoute: typeof LoginRoute
+ StepperRoute: typeof StepperRoute
PlanesPlanIdRouteRoute: typeof PlanesPlanIdRouteRoute
PlanesListaRouteRoute: typeof PlanesListaRouteRouteWithChildren
DemoTanstackQueryRoute: typeof DemoTanstackQueryRoute
@@ -122,6 +135,13 @@ export interface RootRouteChildren {
declare module '@tanstack/react-router' {
interface FileRoutesByPath {
+ '/stepper': {
+ id: '/stepper'
+ path: '/stepper'
+ fullPath: '/stepper'
+ preLoaderRoute: typeof StepperRouteImport
+ parentRoute: typeof rootRouteImport
+ }
'/login': {
id: '/login'
path: '/login'
@@ -189,6 +209,7 @@ const rootRouteChildren: RootRouteChildren = {
IndexRoute: IndexRoute,
DashboardRoute: DashboardRoute,
LoginRoute: LoginRoute,
+ StepperRoute: StepperRoute,
PlanesPlanIdRouteRoute: PlanesPlanIdRouteRoute,
PlanesListaRouteRoute: PlanesListaRouteRouteWithChildren,
DemoTanstackQueryRoute: DemoTanstackQueryRoute,
diff --git a/src/routes/planes/_lista/nuevo.tsx b/src/routes/planes/_lista/nuevo.tsx
index 1c98084..b3bd717 100644
--- a/src/routes/planes/_lista/nuevo.tsx
+++ b/src/routes/planes/_lista/nuevo.tsx
@@ -1,6 +1,6 @@
import { createFileRoute, useNavigate } from '@tanstack/react-router'
-import CheckoutStepper from '@/components/planes/stepper'
+import CheckoutStepper from '@/components/planes/exampleStepper'
import { Dialog, DialogContent } from '@/components/ui/dialog'
export const Route = createFileRoute('/planes/_lista/nuevo')({
diff --git a/src/routes/planes/_lista/route.tsx b/src/routes/planes/_lista/route.tsx
index 71e2e05..3a21a99 100644
--- a/src/routes/planes/_lista/route.tsx
+++ b/src/routes/planes/_lista/route.tsx
@@ -1,4 +1,4 @@
-import { createFileRoute, Outlet, Link } from '@tanstack/react-router'
+import { createFileRoute, Outlet, useNavigate } from '@tanstack/react-router'
import * as Icons from 'lucide-react'
import { useMemo, useState } from 'react'
@@ -13,6 +13,7 @@ export const Route = createFileRoute('/planes/_lista')({
})
function RouteComponent() {
+ const navigate = useNavigate()
type Facultad = { id: string; nombre: string; color: string }
type Carrera = { id: string; nombre: string; facultadId: string }
type Plan = {
@@ -230,6 +231,9 @@ function RouteComponent() {
}
aria-label="Nuevo plan de estudios"
title="Nuevo plan de estudios"
+ onClick={() => {
+ navigate({ to: '/planes/nuevo' })
+ }}
>
Nuevo plan de estudios
@@ -313,9 +317,6 @@ function RouteComponent() {
})}
-
- Nuevo plan de estudios
-
diff --git a/src/routes/stepper.tsx b/src/routes/stepper.tsx
new file mode 100644
index 0000000..b7cfb7b
--- /dev/null
+++ b/src/routes/stepper.tsx
@@ -0,0 +1,65 @@
+import { createFileRoute } from '@tanstack/react-router'
+
+import { defineStepper } from '@/components/stepper'
+import { Button } from '@/components/ui/button'
+
+export const Route = createFileRoute('/stepper')({
+ component: MyFirstStepper,
+})
+
+const stepperInstance = defineStepper(
+ { id: 'step-1', title: 'Step 1' },
+ { id: 'step-2', title: 'Step 2' },
+ { id: 'step-3', title: 'Step 3' },
+)
+
+export function MyFirstStepper() {
+ return (
+
+ {({ methods }) => (
+ <>
+
+ {methods.all.map((step) => (
+ methods.goTo(step.id)}
+ >
+
+ {step.title}
+
+
+ ))}
+
+ {methods.switch({
+ 'step-1': (step) => ,
+ 'step-2': (step) => ,
+ 'step-3': (step) => ,
+ })}
+
+ {!methods.isLast && (
+
+ )}
+
+
+ >
+ )}
+
+ )
+}
+
+const Content = ({ id }: { id: string }) => {
+ return (
+
+ Content for {id}
+
+ )
+}