OOKNET                             [ /  search the index  ]  
──────────────────────────────────────────────────────────────────────────────────────
══════════════════════════════════════════════════════════════════════════════════════
OOKNET   [ /  search  ]  
────────────────────────────────────────────────
════════════════════════════════════════════════
 
 
master @ 23 LINES
 
[ HISTORY ]  [ UP ]
 

---
import Pre from "../Pre/Pre.astro";
import Button from "../Button/Button.astro";
import NavLanguage from "../NavLanguage/NavLanguage.astro";
import { FRAME_W } from "../../lib/config";
import { NAV_ITEMS, NAV_GAP, NAV_LANG_W, isActive, itemsWidth, navRows, type Props
 } from "./NavBar";

const {
  width = FRAME_W,
  items = NAV_ITEMS,
  gap = NAV_GAP,
  lang = true,
} = Astro.props as Props;
const path = Astro.url.pathname;
const rows = navRows(items, width, gap, lang ? NAV_LANG_W + 1 : 0);
const gapStr = " ".repeat(gap);
const pad = (row: typeof items, first: boolean) =>
  " ".repeat(Math.max(1, width - itemsWidth(row, gap) - (first && lang ? NAV_LANG_
W : 0)));
---
{rows.map((row, ri) => (
  <Pre class="nav-bar">{row.map((it, i) => (<Fragment>{i > 0 ? gapStr : ""}<Button
 label={it.label} href={it.href} variant={isActive(it.href, path) ? "primary" : "d
efault"} current={isActive(it.href, path)} /></Fragment>))}{ri === 0 && lang ? pad
(row, true) : ""}{ri === 0 && lang && <NavLanguage />}</Pre>
))}

---
import Pre from "../Pre/Pre.astro";
import Button from "../Button/Button.astro";
import NavLanguage from "../NavLanguage/NavL
anguage.astro";
import { FRAME_W } from "../../lib/config";
import { NAV_ITEMS, NAV_GAP, NAV_LANG_W, isA
ctive, itemsWidth, navRows, type Props } fro
m "./NavBar";

const {
  width = FRAME_W,
  items = NAV_ITEMS,
  gap = NAV_GAP,
  lang = true,
} = Astro.props as Props;
const path = Astro.url.pathname;
const rows = navRows(items, width, gap, lang
 ? NAV_LANG_W + 1 : 0);
const gapStr = " ".repeat(gap);
const pad = (row: typeof items, first: boole
an) =>
  " ".repeat(Math.max(1, width - itemsWidth(
row, gap) - (first && lang ? NAV_LANG_W : 0)
));
---
{rows.map((row, ri) => (
  <Pre class="nav-bar">{row.map((it, i) => (
<Fragment>{i > 0 ? gapStr : ""}<Button label
={it.label} href={it.href} variant={isActive
(it.href, path) ? "primary" : "default"} cur
rent={isActive(it.href, path)} /></Fragment>
))}{ri === 0 && lang ? pad(row, true) : ""}{
ri === 0 && lang && <NavLanguage />}</Pre>
))}
 
──────────────────────────────────────────────────────────────────────────────────────
OOKNET
────────────────────────────────────────────────
OOKNET