Home / Function/ StickyHeader() — supabase Function Reference

StickyHeader() — supabase Function Reference

Architecture documentation for the StickyHeader() function in RefSubLayoutNonFunc.tsx from the supabase codebase.

Entity Profile

Dependency Diagram

graph TD
  79c99230_2459_f86c_5c19_25346a6051fd["StickyHeader()"]
  e83a383f_a9f3_929b_fa3a_abd54dda8063["useNavigationMenuContext()"]
  79c99230_2459_f86c_5c19_25346a6051fd -->|calls| e83a383f_a9f3_929b_fa3a_abd54dda8063
  b6c39fa8_eb5d_6292_0091_ccda003cb449["safeHistoryReplaceState()"]
  79c99230_2459_f86c_5c19_25346a6051fd -->|calls| b6c39fa8_eb5d_6292_0091_ccda003cb449
  style 79c99230_2459_f86c_5c19_25346a6051fd fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/docs/layouts/ref/RefSubLayoutNonFunc.tsx lines 54–87

const StickyHeader: FC<StickyHeader> = (props) => {
  const router = useRouter()
  const { setActiveRefItem } = useNavigationMenuContext()

  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 (
    <h2
      ref={ref}
      id={props.slug}
      data-ref-id={props.id}
      className={[
        'text-xl font-medium text-foreground mb-8 scroll-mt-24',
        props.monoFont && 'font-mono',
      ].join(' ')}
    >
      {props.title && <span className="max-w-xl">{props.title}</span>}
    </h2>
  )
}

Subdomains

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