"use client"; import Link from "next/link"; import { type ReactNode, createContext, useContext } from "react"; import { AnchorIcon } from "./Heading"; export const PropertyContext = createContext<{ name: string; }>({ name: "", }); export function Properties({ children, name, }: { children: ReactNode; name: string }) { return (
); } const numberTypeTooltips = { f64: "64-bit floating-point number", i64: "64-bit signed integer", u64: "64-bit unsigned integer", }; export function Property({ name, children, type, typeLink, numberType, required, }: { name: string; children: ReactNode; type?: string; typeLink?: string; numberType?: "f64" | "i64" | "u64"; required?: boolean; }) { const { name: contextName } = useContext(PropertyContext); const idFormat = (name: string) => name .toLowerCase() .replace(/[^a-z0-9]/g, "-") .replace(/-+/g, "-") .replace(/^-|-$/g, ""); const id = `${idFormat(contextName)}-${idFormat(name)}`; return (
  • Name
    {name}
    {required && ( <>
    Required
    Required
    )} {numberType && ( <>
    Type
    {numberType}
    )} {type && ( <>
    Type
    {typeLink ? ( {type} ) : ( type )}
    )}
    Description
    {children}
  • ); }