master @ 19 LINES
[ HISTORY ] [ UP ]
┌─ TS ───────────────────────────────────────────────────────────────────────┐
│ import { len } from "../../lib/ascii"; │
│ import { TOGGLE_W } from "../ThemeToggle/ThemeToggle"; │
│ │
│ export interface Props { │
│ width?: number; │
│ } │
│ │
│ export const MASTHEAD_LABEL = "OOKNET"; │
│ export const MASTHEAD_SEARCH_WIDE = "[ / search the index ____________________ │
│ ]"; │
│ export const MASTHEAD_SEARCH_NARROW = "[ / search __________________ ]"; │
│ export const MASTHEAD_TOGGLE_GAP = 2; │
│ │
│ /** Spaces between OOKNET and the search input, computed so the row │
│ * totals exactly `width` cells: label + pad + search + gap + toggle. */ │
│ export function mastheadPad(width: number, search: string): string { │
│ const used = len(MASTHEAD_LABEL) + len(search) + MASTHEAD_TOGGLE_GAP + TOGGLE_W; │
│ return " ".repeat(Math.max(1, width - used)); │
│ } │
└────────────────────────────────────────────────────────────────────────────────────┘
┌─ TS ─────────────────────────────────┐
│ import { len } from "../../lib/ascii"; │
│ import { TOGGLE_W } from "../ThemeToggle/The │
│ meToggle"; │
│ │
│ export interface Props { │
│ width?: number; │
│ } │
│ │
│ export const MASTHEAD_LABEL = "OOKNET"; │
│ export const MASTHEAD_SEARCH_WIDE = "[ / │
│ search the index ____________________ ]"; │
│ export const MASTHEAD_SEARCH_NARROW = "[ / │
│ search __________________ ]"; │
│ export const MASTHEAD_TOGGLE_GAP = 2; │
│ │
│ /** Spaces between OOKNET and the search inp │
│ ut, computed so the row │
│ * totals exactly `width` cells: label + pa │
│ d + search + gap + toggle. */ │
│ export function mastheadPad(width: number, s │
│ earch: string): string { │
│ const used = len(MASTHEAD_LABEL) + len(sea │
│ rch) + MASTHEAD_TOGGLE_GAP + TOGGLE_W; │
│ return " ".repeat(Math.max(1, width - used │
│ )); │
│ } │
└──────────────────────────────────────────────┘
──────────────────────────────────────────────────────────────────────────────────────
OOKNET
────────────────────────────────────────────────
OOKNET