68 lines
2.1 KiB
TypeScript
68 lines
2.1 KiB
TypeScript
import { tarotCard, type TarotContent, type TarotReading } from "@/lib/tarot";
|
|||
|
|
|
||
|
|
import { Paragraphs, Rich } from "../Rich";
|
||
|
|
import { TarotCard } from "./TarotCard";
|
||
|
|
|
||
|
|
/**
|
||
|
|
* A written reading: the title and the gist, each card in its position with
|
||
|
|
* its text, how they read together, and the advice.
|
||
|
|
*/
|
||
|
|
export function TarotResult({
|
||
|
|
cards,
|
||
|
|
question,
|
||
|
|
content,
|
||
|
|
}: {
|
||
|
|
cards: TarotReading["cards"];
|
||
|
|
question: string | null;
|
||
|
|
content: TarotContent;
|
||
|
|
}) {
|
||
|
|
return (
|
||
|
|
<article className="tarot-result">
|
||
|
|
<header className="tarot-result-head">
|
||
|
|
<span className="eyebrow">A jóslásod</span>
|
||
|
|
<h2>{content.title}</h2>
|
||
|
|
{question && <p className="tarot-question">„{question}”</p>}
|
||
|
|
<p className="tarot-summary">
|
||
|
|
<Rich text={content.summary} />
|
||
|
|
</p>
|
||
|
|
</header>
|
||
|
|
|
||
|
|
<ol className="tarot-card-texts">
|
||
|
|
{cards.map((c, i) => {
|
||
|
|
const card = tarotCard(c.card);
|
||
|
|
if (!card) return null;
|
||
|
|
return (
|
||
|
|
<li key={`${c.card}-${i}`} className="tarot-card-text">
|
||
|
|
<TarotCard card={card} reversed={c.reversed} className="tarot-card-sm" />
|
||
|
|
<div className="tarot-card-text-body">
|
||
|
|
<span className="eyebrow">
|
||
|
|
{i + 1}. {c.position}
|
||
|
|
</span>
|
||
|
|
<h3>
|
||
|
|
{card.nameHu}
|
||
|
|
{c.reversed && <span className="muted"> · fordított</span>}
|
||
|
|
</h3>
|
||
|
|
{c.about && <p className="hint">{c.about}</p>}
|
||
|
|
<Paragraphs text={content.cards[i]?.body ?? ""} />
|
||
|
|
</div>
|
||
|
|
</li>
|
||
|
|
);
|
||
|
|
})}
|
||
|
|
</ol>
|
||
|
|
|
||
|
|
{content.synthesis && (
|
||
|
|
<section className="tarot-synthesis" aria-label="A lapok együtt">
|
||
|
|
<h3>A lapok együtt</h3>
|
||
|
|
<Paragraphs text={content.synthesis} />
|
||
|
|
</section>
|
||
|
|
)}
|
||
|
|
{content.advice && (
|
||
|
|
<section className="tarot-advice" aria-label="Útravaló">
|
||
|
|
<h3>Útravaló</h3>
|
||
|
|
<Paragraphs text={content.advice} />
|
||
|
|
</section>
|
||
|
|
)}
|
||
|
|
</article>
|
||
|
|
);
|
||
|
|
}
|