Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion genai-cookbook/app/cookbook/[recipe]/code/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export default function RecipeCode({ params }: { params: { recipe?: string } })
fontSize: '0.9rem',
backgroundColor:
colorScheme === 'dark'
? 'var(--mantine-color-gray-9)'
? 'var(--mantine-color-default)'
: 'var(--mantine-color-gray-1)',
}}
>
Expand Down
2 changes: 1 addition & 1 deletion genai-cookbook/app/cookbook/[recipe]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { Flex } from '@mantine/core'

import { appShellContentHeight } from '@/theme/theme'
import { appShellContentHeight } from '@/lib/theme'
import { Toolbar } from '@/components/Toolbar'
import { redirect } from 'next/navigation'
import { cookbookRoute } from '@/lib/constants'
Expand Down
2 changes: 1 addition & 1 deletion genai-cookbook/app/cookbook/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { AppShell } from '@mantine/core'
import { useDisclosure } from '@mantine/hooks'
import { headerHeight, navbarWidth } from '@/theme/theme'
import { headerHeight, navbarWidth } from '@/lib/theme'

import Header from '@/components/Header'
import Navbar from '@/components/Navbar'
Expand Down
23 changes: 7 additions & 16 deletions genai-cookbook/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,36 +1,27 @@
import '@mantine/core/styles.css'
import '@/theme/globals.scss'
import '@/styles/globals.css'

import type { Metadata } from 'next'
import { Inter, Roboto_Mono } from 'next/font/google'
import { ClientThemeProvider } from '@/hooks/ClientThemeProvider'
import { MantineProvider } from '@mantine/core'

import { theme } from '@/lib/theme'
import { CookbookProvider } from '@/hooks/CookbookProvider'

import recipeStore from '@/store/RecipeStore'

const recipes = recipeStore.getAll() ?? []

const inter = Inter({
subsets: ['latin'],
variable: '--inter',
})

const robotoMono = Roboto_Mono({
subsets: ['latin'],
variable: '--roboto',
})

export const metadata: Metadata = {
title: 'Modular GenAI Cookbook',
}

export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html lang="en" className={`${inter.variable} ${robotoMono.variable}`}>
<html lang="en">
<body>
<ClientThemeProvider>
<MantineProvider defaultColorScheme="auto" theme={theme}>
<CookbookProvider recipes={recipes}>{children}</CookbookProvider>
</ClientThemeProvider>
</MantineProvider>
</body>
</html>
)
Expand Down
8 changes: 0 additions & 8 deletions genai-cookbook/components/BodyText.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion genai-cookbook/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Link from 'next/link'
import { ActionIcon, Burger, Flex, Group, Title } from '@mantine/core'
import { IconLayoutSidebar } from '@tabler/icons-react'

import { iconStroke } from '@/theme/theme'
import { iconStroke } from '@/lib/theme'
import { cookbookRoute } from '@/lib/constants'
import { ThemeToggle } from './ThemeToggle'

Expand Down
2 changes: 1 addition & 1 deletion genai-cookbook/components/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { AppShell, Group, ScrollArea, Stack, Text } from '@mantine/core'
import { IconChevronRight } from '@tabler/icons-react'
import { useCookbook } from '@/hooks/useCookbook'
import { cookbookRoute } from '@/lib/constants'
import { iconStroke } from '@/theme/theme'
import { iconStroke } from '@/lib/theme'
import { useSelectedLayoutSegment } from 'next/navigation'

export default function Navbar() {
Expand Down
40 changes: 0 additions & 40 deletions genai-cookbook/hooks/ClientThemeProvider.tsx

This file was deleted.

32 changes: 32 additions & 0 deletions genai-cookbook/lib/theme.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import type { MantineThemeOverride } from '@mantine/core'

export const theme: MantineThemeOverride = {
primaryColor: 'indigo',
defaultRadius: 'xs',
fontFamily:
'Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, Apple Color Emoji, Segoe UI Emoji',
}

export const iconStroke = 1.2
export const headerHeight = 40
export const navbarWidth = 260

export const appShellContentHeight = `calc(100dvh - var(--app-shell-header-offset, ${headerHeight}px) - var(--app-shell-footer-offset, 0px) - (var(--app-shell-padding, var(--mantine-spacing-md)) * 2))`

export const centerStyle: React.CSSProperties = {
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
justifyContent: 'space-between',
overflow: 'hidden',
}

/**
* Utility to derive a height based on the App Shell content area with an extra offset.
* Pass a number (pixels) or a CSS length string (e.g., '2rem').
*/
export function appShellContentHeightWithOffset(offset?: number | string) {
if (!offset || offset === 0) return appShellContentHeight
const asCss = typeof offset === 'number' ? `${offset}px` : offset
return `calc(${appShellContentHeight} - ${asCss})`
}
Loading