Skip to content

Commit

Permalink
feat: add breadcrumbs to documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Valerioageno committed Aug 15, 2024
1 parent a7b7f0e commit b2940d9
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 0 deletions.
46 changes: 46 additions & 0 deletions apps/documentation/src/components/breadcrumbs/breadcrumbs.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import { Breadcrumbs, Button } from '@mantine/core'
import { Link } from 'tuono'

import { IconChevronRight, IconBolt } from '@tabler/icons-react'
import type { ReactNode } from 'react'

export default function TuonoBreadcrumbs({
children,
}: {
children: ReactNode
}): JSX.Element {
return (
<Breadcrumbs
separator={<IconChevronRight size="1.1rem" stroke={1.5} />}
mb="md"
mt="md"
>
<Button href="/" component={Link} variant="subtle" radius="xl" p={5}>
<IconBolt />
</Button>
{children}
</Breadcrumbs>
)
}

interface BreadcrumbElementProps {
href?: string
label: string
}

export function BreadcrumbElement({
href,
label,
}: BreadcrumbElementProps): JSX.Element {
return (
<Button
component={href ? Link : 'span'}
href={href}
variant={href ? 'subtle' : 'light'}
radius="xl"
px={href ? 10 : undefined}
>
{label}
</Button>
)
}
5 changes: 5 additions & 0 deletions apps/documentation/src/components/breadcrumbs/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Breadcrumbs, { BreadcrumbElement } from './breadcrumbs'

export default Breadcrumbs

export { BreadcrumbElement as Element }
6 changes: 6 additions & 0 deletions apps/documentation/src/routes/documentation/contributing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ import { Head } from 'tuono'
<title>Tuono - Contributing</title>
</Head>

import Breadcrumbs, { Element } from '../../components/breadcrumbs'

<Breadcrumbs>
<Element label="Contributing"/>
</Breadcrumbs>

# How to contribute

## TL;DR
Expand Down
5 changes: 5 additions & 0 deletions apps/documentation/src/routes/documentation/installation.mdx
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import { Head } from 'tuono'
import Breadcrumbs, { Element } from '../../components/breadcrumbs'

<Head>
<title>Tuono - Installation</title>
</Head>

<Breadcrumbs>
<Element label="Installation"/>
</Breadcrumbs>

# Installation

## Requirements
Expand Down
8 changes: 8 additions & 0 deletions apps/documentation/src/routes/documentation/routing/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,12 @@ import { Head } from 'tuono'
<title>Tuono - Routing</title>
</Head>

import Breadcrumbs, { Element } from '../../../components/breadcrumbs'

<Breadcrumbs>
<Element label="Routing"/>
</Breadcrumbs>

# Routing index

TODO
7 changes: 7 additions & 0 deletions apps/documentation/src/routes/documentation/routing/intro.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ import { Head } from 'tuono'
<title>Tuono - Routing</title>
</Head>

import Breadcrumbs, { Element } from '../../../components/breadcrumbs'

<Breadcrumbs>
<Element label="Routing" href="/documentation/routing"/>
<Element label="Project structure"/>
</Breadcrumbs>

# Project structure

Todo
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ import { Head } from 'tuono'
<title>Tuono - Tutorial intro</title>
</Head>

import Breadcrumbs, { Element } from '../../../components/breadcrumbs'

<Breadcrumbs>
<Element label="Tutorial"/>
</Breadcrumbs>

# Tutorial intro

TODO

0 comments on commit b2940d9

Please sign in to comment.