/* global React */
const { useState: useEState } = React;
// ============================================================
// TABS
// ============================================================
function Tabs({ tabs }) {
const [active, setActive] = useEState(0);
return (
{tabs.map((t, i) => (
))}
{tabs[active].content}
);
}
// ============================================================
// API BLOCK (parameter list)
// ============================================================
function ApiBlock({ signature, params = [], returns }) {
return (
{signature.name}
(
{signature.args.map((a, i) => (
{a.name}
:
{a.type}
{i < signature.args.length - 1 && , }
))}
)
{signature.returns && (
<>
→
{signature.returns}
>
)}
Parameters
{returns && (
<>
Returns
{returns.type}
— {returns.desc}
>
)}
);
}
// ============================================================
// CARD GRID (feature cards)
// ============================================================
function CardGrid({ cards }) {
return (
);
}
// ============================================================
// SEARCH MODAL
// ============================================================
function SearchModal() {
const recent = ["Routing", "Form::addInputType", "Migrations"];
const results = [
{ section: "The Framework", title: "Routing", excerpt: "URL-pattern + SEO-URL parsing, soft 404, automatic action lookup.", kind: "page" },
{ section: "The Framework", title: "Routing › Soft 404", excerpt: "When a route doesn't match, the dispatcher falls through to a soft 404 view.", kind: "section" },
{ section: "Get Started", title: "Quick Start › Define a route", excerpt: "Routes are declared in config/routes.php and matched by URL pattern.", kind: "section" },
{ section: "API", title: "Router::register()", excerpt: "Register a new route at runtime. Supports pattern matching with named parameters.", kind: "api" },
];
return (
Recent
{recent.map((r, i) => (
))}
Results
{results.map((r, i) => (
))}
↑↓ navigate
↵ open
⌘K close
Powered by Nibiru Search
);
}
// ============================================================
// FAB (floating help button)
// ============================================================
function FAB() {
return (
);
}
// ============================================================
// PAGINATION (prev / next page)
// ============================================================
function Pagination({ prev, next }) {
return (
);
}
// ============================================================
// MOBILE DRAWER
// ============================================================
function MobileDrawer() {
return (
);
}
// ============================================================
// 404 / EMPTY STATE
// ============================================================
function NotFound() {
return (
404 / off-orbit
This page drifted away from Nibiru.
The probe couldn't find the page you requested. It may have been moved, renamed, or pulled into a different orbit.
);
}
Object.assign(window, { Tabs, ApiBlock, CardGrid, SearchModal, FAB, Pagination, MobileDrawer, NotFound });