master @ 17 LINES
[ HISTORY ] [ UP ]
┌─ TS ───────────────────────────────────────────────────────────────────────┐
│ import { len } from "../../lib/ascii"; │
│ │
│ export interface MenuItem { │
│ label: string; │
│ href?: string; │
│ } │
│ │
│ export interface Props { │
│ label: string; │
│ items: MenuItem[]; │
│ /** Inner width in cells; defaults to the widest item label. */ │
│ cells?: number; │
│ } │
│ │
│ export const menuCells = (items: MenuItem[]) => │
│ Math.max(1, ...items.map((it) => len(it.label))); │
└────────────────────────────────────────────────────────────────────────────────────┘
┌─ TS ─────────────────────────────────┐
│ import { len } from "../../lib/ascii"; │
│ │
│ export interface MenuItem { │
│ label: string; │
│ href?: string; │
│ } │
│ │
│ export interface Props { │
│ label: string; │
│ items: MenuItem[]; │
│ /** Inner width in cells; defaults to the │
│ widest item label. */ │
│ cells?: number; │
│ } │
│ │
│ export const menuCells = (items: MenuItem[]) │
│ => │
│ Math.max(1, ...items.map((it) => len(it.la │
│ bel))); │
└──────────────────────────────────────────────┘
──────────────────────────────────────────────────────────────────────────────────────
OOKNET
────────────────────────────────────────────────
OOKNET