diff --git a/apps/web/src/app/features/demo/demo-feature-grid-routes.tsx b/apps/web/src/app/features/demo/demo-feature-grid-routes.tsx
index b719a67..f70fc1b 100644
--- a/apps/web/src/app/features/demo/demo-feature-grid-routes.tsx
+++ b/apps/web/src/app/features/demo/demo-feature-grid-routes.tsx
@@ -1,5 +1,6 @@
-import { SimpleGrid } from '@mantine/core'
+import { Badge, SimpleGrid } from '@mantine/core'
import { UiCard, UiGridRoutes } from '@pubkey-ui/core'
+import { IconDashboard } from '@tabler/icons-react'
export function DemoFeatureGridRoutes() {
return (
@@ -8,11 +9,17 @@ export function DemoFeatureGridRoutes() {
basePath="/demo/grid-routes"
routes={[
{
- path: 'overview',
- label: 'Overview',
+ path: 'dashboard',
+ label: 'Dashboard',
+ leftSection: ,
+ rightSection: (
+
+ New
+
+ ),
element: (
- Overview
+ Dashboard
),
},
@@ -24,6 +31,11 @@ export function DemoFeatureGridRoutes() {
Content
),
+ rightSection: (
+
+ New
+
+ ),
},
{
path: 'settings',
diff --git a/packages/core/src/lib/ui-grid-routes/ui-grid-routes.tsx b/packages/core/src/lib/ui-grid-routes/ui-grid-routes.tsx
index bf1358e..e3204d5 100644
--- a/packages/core/src/lib/ui-grid-routes/ui-grid-routes.tsx
+++ b/packages/core/src/lib/ui-grid-routes/ui-grid-routes.tsx
@@ -1,11 +1,11 @@
-import { Grid, GridColProps, GridProps, NavLink } from '@mantine/core'
+import { Grid, GridColProps, GridProps, NavLink, NavLinkProps } from '@mantine/core'
import { ReactNode, useMemo } from 'react'
import { Link, Navigate, useLocation, useRoutes } from 'react-router-dom'
import { UiNotFound } from '../ui-not-found'
-export interface UiGridRoute {
+export interface UiGridRoute extends NavLinkProps {
path: string
- label?: string
+ label?: ReactNode
element: ReactNode
}
export interface UiGridRoutesProps extends GridProps {
@@ -22,9 +22,11 @@ export function UiGridRoutes({ basePath, routes, leftColProps, rightColProps, ..
() =>
routes
.filter((app) => app.label)
- .map((app) => {
- const to = `${basePath}/${app.path}`
- return
+ .map(({ path, label, element, ...props }) => {
+ const to = `${basePath}/${path}`
+ return (
+
+ )
}),
[basePath, pathname, routes],
)
diff --git a/packages/generators/src/generators/component/files/grid-routes/__prefixFileName__-grid-routes.tsx.template b/packages/generators/src/generators/component/files/grid-routes/__prefixFileName__-grid-routes.tsx.template
index 869a9e2..f6cadc9 100644
--- a/packages/generators/src/generators/component/files/grid-routes/__prefixFileName__-grid-routes.tsx.template
+++ b/packages/generators/src/generators/component/files/grid-routes/__prefixFileName__-grid-routes.tsx.template
@@ -1,11 +1,11 @@
-import { Grid, GridColProps, GridProps, NavLink } from '@mantine/core'
+import { Grid, GridColProps, GridProps, NavLink, NavLinkProps } from '@mantine/core'
import { ReactNode, useMemo } from 'react'
import { Link, Navigate, useLocation, useRoutes } from 'react-router-dom'
import { <%= prefix.className %>NotFound } from '../<%= prefix.fileName %>-not-found'
-export interface <%= prefix.className %>GridRoute {
+export interface <%= prefix.className %>GridRoute extends NavLinkProps {
path: string
- label?: string
+ label?: ReactNode
element: ReactNode
}
export interface <%= prefix.className %>GridRoutesProps extends GridProps {
@@ -22,9 +22,11 @@ export function <%= prefix.className %>GridRoutes({ basePath, routes, leftColPro
() =>
routes
.filter((app) => app.label)
- .map((app) => {
- const to = `${basePath}/${app.path}`
- return
+ .map(({ path, label, element, ...props }) => {
+ const to = `${basePath}/${path}`
+ return (
+
+ )
}),
[basePath, pathname, routes],
)
diff --git a/packages/generators/src/generators/feature/files/demo/demo-feature-grid-routes.tsx.template b/packages/generators/src/generators/feature/files/demo/demo-feature-grid-routes.tsx.template
index f8dbdf1..8905f4d 100644
--- a/packages/generators/src/generators/feature/files/demo/demo-feature-grid-routes.tsx.template
+++ b/packages/generators/src/generators/feature/files/demo/demo-feature-grid-routes.tsx.template
@@ -1,5 +1,6 @@
-import { SimpleGrid } from '@mantine/core'
+import { Badge, SimpleGrid } from '@mantine/core'
import { <%= prefix.className %>Card, <%= prefix.className %>GridRoutes } from '<%= uiImport %>'
+import { IconDashboard } from '@tabler/icons-react'
export function DemoFeatureGridRoutes() {
return (
@@ -8,11 +9,17 @@ export function DemoFeatureGridRoutes() {
basePath="/demo/grid-routes"
routes={[
{
- path: 'overview',
- label: 'Overview',
+ path: 'dashboard',
+ label: 'Dashboard',
+ leftSection: ,
+ rightSection: (
+
+ New
+
+ ),
element: (
- <<%= prefix.className %>Card title="Overview">Overview<%= prefix.className %>Card>
+ Dashboard
),
},
@@ -21,16 +28,21 @@ export function DemoFeatureGridRoutes() {
label: 'Content',
element: (
- <<%= prefix.className %>Card title="Content">Content<%= prefix.className %>Card>
+ Content
),
+ rightSection: (
+
+ New
+
+ ),
},
{
path: 'settings',
label: 'Settings',
element: (
- <<%= prefix.className %>Card title="Settings">Settings<%= prefix.className %>Card>
+ Settings
),
},