master @ 35 LINES
[ HISTORY ] [ UP ]
┌─ ASTRO ────────────────────────────────────────────────────────────────────┐
│ --- │
│ import Pre from "../Pre/Pre.astro"; │
│ import { FRAME_W, MOBILE_FRAME_W } from "../../lib/config"; │
│ import { layoutPath, pathSegs, type PathSeg, type Props } from "./GitPath"; │
│ import "../GitHeader/GitHeader.scss"; │
│ │
│ const { repo, branch, path, linkLeaf = false } = Astro.props as Props; │
│ const segs = pathSegs(repo, branch, path, linkLeaf); │
│ const variants: [string, PathSeg[][]][] = [ │
│ ["frame-wide", layoutPath(segs, FRAME_W)], │
│ ["frame-narrow", layoutPath(segs, MOBILE_FRAME_W)], │
│ ]; │
│ --- │
│ <nav class="git-path" aria-label="Path"> │
│ {variants.map(([cls, rows]) => │
│ rows.map((row, i) => ( │
│ <Pre class={cls}>{i > 0 ? " " : ""}{row.map((s, j) => ( │
│ <Fragment>{(j > 0 || i > 0) && !s.cont ? " / " : ""}{s.href │
│ ? <a class="git-link" href={s.href}>{s.label}</a> │
│ : <span class="git-path-leaf">{s.label}</span>}</Fragment> │
│ ))}</Pre> │
│ )) │
│ )} │
│ </nav> │
│ │
│ <style lang="scss"> │
│ .git-path { │
│ display: block; │
│ │
│ .git-path-leaf { │
│ font-weight: 600; │
│ } │
│ } │
│ </style> │
└────────────────────────────────────────────────────────────────────────────────────┘
┌─ ASTRO ──────────────────────────────┐
│ --- │
│ import Pre from "../Pre/Pre.astro"; │
│ import { FRAME_W, MOBILE_FRAME_W } from "../ │
│ ../lib/config"; │
│ import { layoutPath, pathSegs, type PathSeg, │
│ type Props } from "./GitPath"; │
│ import "../GitHeader/GitHeader.scss"; │
│ │
│ const { repo, branch, path, linkLeaf = false │
│ } = Astro.props as Props; │
│ const segs = pathSegs(repo, branch, path, li │
│ nkLeaf); │
│ const variants: [string, PathSeg[][]][] = [ │
│ ["frame-wide", layoutPath(segs, FRAME_W)], │
│ ["frame-narrow", layoutPath(segs, MOBILE_F │
│ RAME_W)], │
│ ]; │
│ --- │
│ <nav class="git-path" aria-label="Path"> │
│ {variants.map(([cls, rows]) => │
│ rows.map((row, i) => ( │
│ <Pre class={cls}>{i > 0 ? " " : ""}{r │
│ ow.map((s, j) => ( │
│ <Fragment>{(j > 0 || i > 0) && !s.co │
│ nt ? " / " : ""}{s.href │
│ ? <a class="git-link" href={s.href │
│ }>{s.label}</a> │
│ : <span class="git-path-leaf">{s.l │
│ abel}</span>}</Fragment> │
│ ))}</Pre> │
│ )) │
│ )} │
│ </nav> │
│ │
│ <style lang="scss"> │
│ .git-path { │
│ display: block; │
│ │
│ .git-path-leaf { │
│ font-weight: 600; │
│ } │
│ } │
│ </style> │
└──────────────────────────────────────────────┘
──────────────────────────────────────────────────────────────────────────────────────
OOKNET
────────────────────────────────────────────────
OOKNET