Aspect grid: row and column headers, so both points of a cell are visible
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
This commit is contained in:
@@ -230,6 +230,8 @@ td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
|
||||
}
|
||||
.aspect-grid th { color: var(--ink); font-weight: 400; font-size: 17px; background: var(--panel-2); }
|
||||
.aspect-grid .grid-angle { font: 600 11px var(--font-body); color: var(--gold); letter-spacing: 0.3px; }
|
||||
.aspect-grid td.void, .aspect-grid td.corner { border: 0; background: none; }
|
||||
.aspect-grid tbody td:not(.void):hover { background: var(--panel-2); }
|
||||
.asp-conjunction { color: var(--gold); }
|
||||
.asp-trine, .asp-sextile { color: var(--harmonic); }
|
||||
.asp-square { color: var(--square); }
|
||||
|
||||
@@ -84,33 +84,53 @@ function AspectGrid({ chart }: { chart: Chart }) {
|
||||
byPair.set(`${a.point2}|${a.point1}`, a);
|
||||
}
|
||||
|
||||
const label = ([id, text]: [string, string]) => (
|
||||
<span className={text.length > 2 ? "sym" : "grid-angle"} aria-label={pointName(id)} role="img">
|
||||
{text}
|
||||
</span>
|
||||
);
|
||||
// Lower triangle with both headers: rows from the 2nd point, columns up to the last but one.
|
||||
const cols = rows.slice(0, -1);
|
||||
|
||||
return (
|
||||
<div className="aspect-grid-wrap">
|
||||
<table className="aspect-grid" aria-label="Fényszögmátrix">
|
||||
<tbody>
|
||||
{rows.map(([id, label], i) => (
|
||||
<tr key={id}>
|
||||
{rows.slice(0, i).map(([other]) => {
|
||||
const a = byPair.get(`${id}|${other}`);
|
||||
const info = a ? ASPECTS[a.aspect] : undefined;
|
||||
const text = a ? `${pointName(other)} ${info?.hu ?? a.aspect} ${pointName(id)}` : undefined;
|
||||
return (
|
||||
<td key={other} title={text}>
|
||||
{a && (
|
||||
<span className={`sym asp asp-${a.aspect}`} aria-label={text} role="img">
|
||||
{info?.glyph ?? "?"}
|
||||
</span>
|
||||
)}
|
||||
</td>
|
||||
);
|
||||
})}
|
||||
<th scope="row" title={pointName(id)}>
|
||||
<span className={label.length > 2 ? "sym" : "grid-angle"} aria-label={pointName(id)} role="img">
|
||||
{label}
|
||||
</span>
|
||||
<thead>
|
||||
<tr>
|
||||
<td className="corner" />
|
||||
{cols.map((c) => (
|
||||
<th key={c[0]} scope="col" title={pointName(c[0])}>
|
||||
{label(c)}
|
||||
</th>
|
||||
</tr>
|
||||
))}
|
||||
))}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{rows.slice(1).map((row, r) => {
|
||||
const [id] = row;
|
||||
return (
|
||||
<tr key={id}>
|
||||
<th scope="row" title={pointName(id)}>
|
||||
{label(row)}
|
||||
</th>
|
||||
{cols.map(([other], j) => {
|
||||
if (j > r) return <td key={other} className="void" />;
|
||||
const a = byPair.get(`${id}|${other}`);
|
||||
const info = a ? ASPECTS[a.aspect] : undefined;
|
||||
const text = a ? `${pointName(other)} ${info?.hu ?? a.aspect} ${pointName(id)}` : undefined;
|
||||
return (
|
||||
<td key={other} title={text}>
|
||||
{a && (
|
||||
<span className={`sym asp asp-${a.aspect}`} aria-label={text} role="img">
|
||||
{info?.glyph ?? "?"}
|
||||
</span>
|
||||
)}
|
||||
</td>
|
||||
);
|
||||
})}
|
||||
</tr>
|
||||
);
|
||||
})}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user