44 lines
1.4 KiB
TypeScript
44 lines
1.4 KiB
TypeScript
import Link from "next/link";
|
||||
|
|
|
|||
|
|
import { SIGNS, formatBirthDate } from "@/lib/astro";
|
|||
|
|
import type { ChartListItem } from "@/lib/types";
|
|||
|
|
|
|||
|
|
/** Sun, Moon and Ascendant sign glyphs of a chart. */
|
|||
|
|
export function SignTrio({ chart }: { chart: ChartListItem }) {
|
|||
|
|
const h = chart.highlights;
|
|||
|
|
const items: [string, string | null][] = [
|
|||
|
|
["☉", h.sun],
|
|||
|
|
["☽", h.moon],
|
|||
|
|
["AC", h.time_known ? h.ascendant : null],
|
|||
|
|
];
|
|||
|
|
return (
|
|||
|
|
<span className="sign-trio" aria-hidden="true">
|
|||
|
|
{items.map(([k, sign]) => (
|
|||
|
|
<span key={k}>
|
|||
|
|
<span className={k === "AC" ? "trio-ac" : "sym"}>{k}</span>
|
|||
|
|
<span className="sym trio-sign">{sign ? SIGNS[sign]?.glyph : "–"}</span>
|
|||
|
|
</span>
|
|||
|
|
))}
|
|||
|
|
</span>
|
|||
|
|
);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/** One chart in the list: name, birth date and place, the three main signs. */
|
|||
|
|
export function ChartCard({ chart, title, children }: { chart: ChartListItem; title: string; children?: React.ReactNode }) {
|
|||
|
|
const { birth } = chart;
|
|||
|
|
return (
|
|||
|
|
<div className="chart-card">
|
|||
|
|
<Link href={`/kepletek/${chart.id}`} className="chart-card-link">
|
|||
|
|
<strong className="chart-card-name">{title}</strong>
|
|||
|
|
<span className="muted">
|
|||
|
|
{formatBirthDate(birth.date)}
|
|||
|
|
{birth.time ? `, ${birth.time.slice(0, 5)}` : ""}
|
|||
|
|
{birth.place ? ` · ${birth.place}` : ""}
|
|||
|
|
</span>
|
|||
|
|
<SignTrio chart={chart} />
|
|||
|
|
</Link>
|
|||
|
|
{children}
|
|||
|
|
</div>
|
|||
|
|
);
|
|||
|
|
}
|