master @ 11 LINES
[ HISTORY ] [ UP ]
┌─ ASTRO ────────────────────────────────────────────────────────────────────┐
│ --- │
│ import type { Props, SelectOption } from "./Select"; │
│ import "./Select.scss"; │
│ │
│ const { name, options, cells, value } = Astro.props as Props; │
│ const opts: SelectOption[] = options.map((o) => │
│ typeof o === "string" ? { value: o, label: o } : o, │
│ ); │
│ --- │
│ <span class="select">{"[ "}<select name={name} style={`width: calc(var(--cell-w) * │
│ ${cells})`}>{opts.map((o) => <option value={o.value} selected={o.value === value} │
│ >{o.label}</option>)}</select>{" ↓ ]"}</span> │
└────────────────────────────────────────────────────────────────────────────────────┘
┌─ ASTRO ──────────────────────────────┐
│ --- │
│ import type { Props, SelectOption } from "./ │
│ Select"; │
│ import "./Select.scss"; │
│ │
│ const { name, options, cells, value } = Astr │
│ o.props as Props; │
│ const opts: SelectOption[] = options.map((o) │
│ => │
│ typeof o === "string" ? { value: o, label: │
│ o } : o, │
│ ); │
│ --- │
│ <span class="select">{"[ "}<select name={nam │
│ e} style={`width: calc(var(--cell-w) * ${cel │
│ ls})`}>{opts.map((o) => <option value={o.val │
│ ue} selected={o.value === value}>{o.label}</ │
│ option>)}</select>{" ↓ ]"}</span> │
└──────────────────────────────────────────────┘
──────────────────────────────────────────────────────────────────────────────────────
OOKNET
────────────────────────────────────────────────
OOKNET