StickyHeader() — supabase Function Reference
Architecture documentation for the StickyHeader() function in RefSubLayout.tsx from the supabase codebase.
Entity Profile
Dependency Diagram
graph TD e54a4489_ccbe_5fd0_48bf_4f6c6bdcbc11["StickyHeader()"] e83a383f_a9f3_929b_fa3a_abd54dda8063["useNavigationMenuContext()"] e54a4489_ccbe_5fd0_48bf_4f6c6bdcbc11 -->|calls| e83a383f_a9f3_929b_fa3a_abd54dda8063 b6c39fa8_eb5d_6292_0091_ccda003cb449["safeHistoryReplaceState()"] e54a4489_ccbe_5fd0_48bf_4f6c6bdcbc11 -->|calls| b6c39fa8_eb5d_6292_0091_ccda003cb449 style e54a4489_ccbe_5fd0_48bf_4f6c6bdcbc11 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
apps/docs/layouts/ref/RefSubLayout.tsx lines 86–136
const StickyHeader: FC<StickyHeader> = ({ icon, ...props }) => {
const router = useRouter()
const { setActiveRefItem } = useNavigationMenuContext()
// we're serving search bots a different file (/crawlers/[...slug])
// and need to modify content to suit that
const isCrawlerPage = router?.route.includes('/crawlers/[...slug]') || false
const { ref } = useInView({
threshold: 1,
rootMargin: '30% 0% -35% 0px',
onChange: (inView, entry) => {
if (inView && window) highlightSelectedNavItem(entry.target.attributes['data-ref-id'].value)
if (inView && props.scrollSpyHeader) {
safeHistoryReplaceState(entry.target.id)
// if (setActiveRefItem) setActiveRefItem(entry.target.attributes['data-ref-id'].value)
menuState.setMenuActiveRefId(entry.target.attributes['data-ref-id'].value)
// router.push(`/reference/javascript/${entry.target.attributes['data-ref-id'].value}`, null, {
// shallow: true,
// })
}
},
})
return (
<div className={['flex items-center gap-3 not-prose', icon && 'mb-8'].join(' ')}>
{icon && (
<div className="w-8 h-8 bg-brand-300 rounded flex items-center justify-center">
<Image width={16} height={16} alt={icon} src={`${icon}.svg`} />
</div>
)}
{isCrawlerPage ? (
<h1>{props.title}</h1>
) : (
<h2
ref={ref}
id={props.slug}
data-ref-id={props.id}
className={cn(
'text-2xl font-medium text-foreground scroll-mt-[calc(32px+2rem)] lg:scroll-mt-[calc(var(--header-height)+1px+4rem)]',
!icon && 'mb-8',
props.monoFont && 'font-mono'
)}
>
{props.title && <span className="max-w-xl">{props.title}</span>}
</h2>
)}
</div>
)
}
Domain
Subdomains
Source
Frequently Asked Questions
What does StickyHeader() do?
StickyHeader() is a function in the supabase codebase.
What does StickyHeader() call?
StickyHeader() calls 2 function(s): safeHistoryReplaceState, useNavigationMenuContext.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free