mirror of
https://github.com/supabase/supabase.git
synced 2026-09-07 02:20:52 +08:00
https://github.com/user-attachments/assets/fba86c42-a122-4eb5-8531-db663d022100 Makes a few style and content changes focused on our quickstarts, starting with - docs/guides/getting-started/quickstarts/reactjs - docs/guides/getting-started/quickstarts/nextjs. Changes - Reduced container size and increased x padding for more breathing room - Adjusted header padding and spacing - Stripped non critical content from guides - Merged steps where possible e.g. one sql blocks to run instead of multiple - Moved shadcn/supabase ui components into a next step - Introduced a step for installing agent skills (in future can be plugin) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Updated multiple quickstarts to add an **“Open Connect panel”** primary action for environment-variable setup. * Removed extra UI CTA partials from several “Query” sections. * Added **Next steps** links to drop-in UI components and extended the database flow with an optional **agent skills** step. * **UI / Guide Layout** * Refreshed guide spacing/typography (breadcrumb spacing, header margins, and removed subtitle divider). * Adjusted guide/table-of-contents sizing and tightened step/details and code section alignment. * Updated main layout width and padding for docs pages. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Chris Chinchilla <chris.ward@supabase.io> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
70 lines
2.0 KiB
TypeScript
70 lines
2.0 KiB
TypeScript
'use client'
|
|
|
|
import GuidesTableOfContents from '~/components/GuidesSidebar'
|
|
import { TocAnchorsProvider } from '~/features/docs/GuidesMdx.client'
|
|
import { type GuideFrontmatter } from '~/lib/docs'
|
|
import { createContext, useContext, type ReactNode } from 'react'
|
|
import { cn } from 'ui'
|
|
|
|
interface GuideContextValue {
|
|
meta?: GuideFrontmatter
|
|
}
|
|
|
|
const GuideContext = createContext<GuideContextValue | undefined>(undefined)
|
|
|
|
export const useGuide = () => {
|
|
const context = useContext(GuideContext)
|
|
if (!context) {
|
|
throw new Error('useGuide must be used within a GuideProvider')
|
|
}
|
|
return context
|
|
}
|
|
|
|
interface GuideProps {
|
|
meta?: GuideFrontmatter
|
|
children?: ReactNode
|
|
className?: string
|
|
}
|
|
|
|
export function Guide({ meta, children, className }: GuideProps) {
|
|
const hideToc = meta?.hideToc || meta?.hide_table_of_contents
|
|
|
|
return (
|
|
<GuideContext.Provider value={{ meta }}>
|
|
<TocAnchorsProvider>
|
|
<div className={cn('grid grid-cols-12 relative gap-4', className)}>
|
|
<div
|
|
className={cn(
|
|
'relative',
|
|
'transition-all ease-out',
|
|
'duration-100',
|
|
hideToc ? 'col-span-12' : 'col-span-12 md:col-span-8'
|
|
)}
|
|
>
|
|
{children}
|
|
</div>
|
|
{!hideToc && (
|
|
<GuidesTableOfContents
|
|
video={meta?.tocVideo}
|
|
className={cn(
|
|
'hidden md:flex',
|
|
'md:col-span-3 md:col-start-10',
|
|
'self-start',
|
|
'sticky',
|
|
/**
|
|
* --header-height: height of nav
|
|
* 1px: height of nav border
|
|
* 3rem: content padding
|
|
*/
|
|
'top-[calc(var(--header-height)+1px+3rem)]',
|
|
// 4rem accounts for 3rem of top padding + 1rem of extra breathing room
|
|
'max-h-[calc(100vh-var(--header-height)-4rem)]'
|
|
)}
|
|
/>
|
|
)}
|
|
</div>
|
|
</TocAnchorsProvider>
|
|
</GuideContext.Provider>
|
|
)
|
|
}
|