Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

2.5 KB
Raw Blame
import SectionContainer from '~/components/Layouts/SectionContainer'
import ProductModules from '~/data/ProductModules'
import Link from 'next/link'
import React from 'react'
import { PRODUCT_MODULES_NAMES } from 'shared-data/products'
import { cn, IconDocumentation } from 'ui'

interface Props {
  activePage: PRODUCT_MODULES_NAMES
  docsUrl?: string
}

function ModulesNav({ activePage, docsUrl }: Props) {
  return (
    <nav className="sticky top-0 mb-4 z-30 flex flex-nowrap items-center bg-alternative/90 backdrop-blur-md w-full border-b border-muted">
      <SectionContainer className="w-full py-0! flex gap-3 items-center justify-between">
        <div className="w-max flex gap-3 items-center">
          {Object.entries(ProductModules).map((obj) => {
            const currentModule = obj[1]

            return (
              <Link
                key={currentModule.name}
                className={cn(
                  'flex items-center gap-1.5 px-2 first:-ml-2 py-3 border-b border-transparent text-sm text-foreground-lighter hover:text-foreground',
                  'focus-ring focus-visible:text-foreground',
                  currentModule.name === activePage && 'border-foreground-light text-foreground'
                )}
                href={currentModule.url ?? ''}
              >
                <svg
                  className="h-4 w-4 group-hover/menu-item:text-foreground group-focus-visible/menu-item:text-foreground"
                  xmlns="http://www.w3.org/2000/svg"
                  fill="none"
                  viewBox="0 0 24 24"
                >
                  <path
                    strokeLinecap="round"
                    strokeLinejoin="round"
                    strokeWidth="1"
                    d={currentModule.icon}
                    stroke="currentColor"
                  />
                </svg>
                <p>{currentModule.name}</p>
              </Link>
            )
          })}
        </div>
        <div className="flex gap-3 items-center">
          {docsUrl && (
            <Link
              className={cn(
                'flex items-center gap-1.5 py-3 border-b border-transparent text-sm text-foreground-lighter hover:text-foreground',
                'focus-ring focus-visible:text-foreground'
              )}
              href={docsUrl}
            >
              <IconDocumentation size={14} strokeWidth={1.2} /> Docs
            </Link>
          )}
        </div>
      </SectionContainer>
    </nav>
  )
}

export default ModulesNav