Skip to content

Commit

Permalink
feat: update sidebar titles and colors
Browse files Browse the repository at this point in the history
  • Loading branch information
Valerio Ageno committed Dec 4, 2024
1 parent 4a65377 commit ff61b52
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 27 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
.link {
border-radius: 8px;
margin-top: 0.25rem;
line-height: 1rem;
font-weight: 500;
border-radius: 8px;
margin-top: 0.25rem;
line-height: 1rem;
font-weight: 500;
transition: 0.3s;
}

.link span {
font-size: 14px;
}

.sublink span {
color: gray;
font-size: 14px !important;
color: var(--mantine-color-sidebar-gray);
}
7 changes: 5 additions & 2 deletions apps/documentation/src/components/sidebar/sidebar-link.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { JSX, ReactNode } from 'react'
import { NavLink, type NavLinkProps } from '@mantine/core'
import clsx from 'clsx'
import { Link, useRouter } from 'tuono'
import { IconChevronRight } from '@tabler/icons-react'

Expand All @@ -17,9 +18,11 @@ export default function SidebarLink(
): JSX.Element {
const { pathname } = useRouter()

const isActive = pathname === props.href

const internalProps = {
active: pathname === props.href,
className: styles.link,
active: isActive,
className: clsx(styles.link),
rightSection: props.children && (
<IconChevronRight
size="1.2rem"
Expand Down
43 changes: 28 additions & 15 deletions apps/documentation/src/components/sidebar/sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
Title,
Button,
ScrollArea,
Text,
} from '@mantine/core'

import SidebarLink from './sidebar-link'

Check failure on line 13 in apps/documentation/src/components/sidebar/sidebar.tsx

View workflow job for this annotation

GitHub Actions / Check format, lint and types

There should be at least one empty line between import groups

Check failure on line 13 in apps/documentation/src/components/sidebar/sidebar.tsx

View workflow job for this annotation

GitHub Actions / Check format, lint and types

`./sidebar-link` import should occur after import of `@mantine/hooks`
Expand Down Expand Up @@ -107,6 +108,9 @@ export default function Sidebar({ close }: SidebarProps): JSX.Element {
/>
</SidebarLink>
<Divider my="md" />
<Text size="xs" fw={700} fz={12} pl={12} py={5}>
Overview
</Text>
<SidebarLink label="Routing" href="#required-for-focus">
<SidebarLink
href="/documentation/routing/intro"
Expand Down Expand Up @@ -152,6 +156,30 @@ export default function Sidebar({ close }: SidebarProps): JSX.Element {
onClick={close}
/>
</SidebarLink>
<Divider my="md" />
<Text size="xs" fw={700} fz={12} pl={12} py={5}>
API reference
</Text>
<SidebarLink label="Components" href="#required-for-focus">
<SidebarLink
href="/documentation/routing/intro"
label="Head"
onClick={close}
/>
</SidebarLink>
<SidebarLink label="Hooks" href="#required-for-focus">
<SidebarLink
href="/documentation/routing/intro"
label="Head"
onClick={close}
/>
</SidebarLink>
<SidebarLink
href="/documentation/routing/intro"
label="tuono.config.ts"
onClick={close}
/>
<Divider my="md" />
<SidebarLink
label="Contributing"
href="#required-for-focus"
Expand All @@ -168,21 +196,6 @@ export default function Sidebar({ close }: SidebarProps): JSX.Element {
onClick={close}
/>
</SidebarLink>
<Divider my="md" />
<SidebarLink label="Components" href="#required-for-focus">
<SidebarLink
href="/documentation/routing/intro"
label="Head"
onClick={close}
/>
</SidebarLink>
<SidebarLink label="Hooks" href="#required-for-focus">
<SidebarLink
href="/documentation/routing/intro"
label="Head"
onClick={close}
/>
</SidebarLink>
</AppShell.Section>
</AppShell.Navbar>
)
Expand Down
17 changes: 16 additions & 1 deletion apps/documentation/src/routes/__root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type { ReactNode, JSX } from 'react'
import {

Check failure on line 3 in apps/documentation/src/routes/__root.tsx

View workflow job for this annotation

GitHub Actions / Check format, lint and types

Imports "CSSVariablesResolver" are only used as type
ColorSchemeScript,
createTheme,
CSSVariablesResolver,
MantineProvider,
AppShell,
Container,
Expand Down Expand Up @@ -60,6 +61,20 @@ const theme = createTheme({
},
},
},
other: {
sidebarGrayLight: '#343a40',
sidebarGrayDark: '#adb5bd',
},
})

const resolver: CSSVariablesResolver = (theme) => ({

Check failure on line 70 in apps/documentation/src/routes/__root.tsx

View workflow job for this annotation

GitHub Actions / Check format, lint and types

'theme' is already declared in the upper scope on line 26 column 7
variables: {},
light: {
'--mantine-color-sidebar-gray': theme.other.sidebarGrayLight,

Check failure on line 73 in apps/documentation/src/routes/__root.tsx

View workflow job for this annotation

GitHub Actions / Check format, lint and types

Unsafe assignment of an `any` value
},
dark: {
'--mantine-color-sidebar-gray': theme.other.sidebarGrayDark,

Check failure on line 76 in apps/documentation/src/routes/__root.tsx

View workflow job for this annotation

GitHub Actions / Check format, lint and types

Unsafe assignment of an `any` value
},
})

export default function RootRoute({ children }: RootRouteProps): JSX.Element {
Expand All @@ -77,7 +92,7 @@ export default function RootRoute({ children }: RootRouteProps): JSX.Element {
<link rel="manifest" href="/site.webmanifest" />
</Head>
<ColorSchemeScript />
<MantineProvider theme={theme}>
<MantineProvider theme={theme} cssVariablesResolver={resolver}>
<AppShell
layout="alt"
header={{ height: 60 }}
Expand Down

0 comments on commit ff61b52

Please sign in to comment.