- Menu items with gold astrological marks (☉ ☽ ☌, card, box); the free pages (signs, famous people, moon calendar, retrogrades) in one "Felfedezés" dropdown with a line about each, opened by a click - A starry header band with a gold edge; the current item has a glowing gold underline - "Ma: Hold a ♉ Bikában" with the Moon's phase drawn as it is lit, to the moon calendar (narrower screens: the phase and the glyph) - The ☰ menu grouped: the Moon today, Saját, Felfedezés · ingyenes as tiles, Csomagok with the package; it covers the page now - Laptops (1440px) keep the row on one line Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
59 lines
1.8 KiB
TypeScript
59 lines
1.8 KiB
TypeScript
import Link from "next/link";
|
||
|
||
import { SIGNS } from "@/lib/astro";
|
||
import { SIGN_IN, withArticle } from "@/lib/skyText";
|
||
import type { SkyNow } from "@/lib/types";
|
||
|
||
/** The Moon as it is lit now: the lit part on the right while waxing, on the left while waning. */
|
||
export function MoonPhaseIcon({
|
||
illumination,
|
||
waxing,
|
||
}: {
|
||
illumination: number;
|
||
waxing: boolean;
|
||
}) {
|
||
const r = 8.5;
|
||
const k = Math.min(1, Math.max(0, illumination));
|
||
const rx = Math.abs(1 - 2 * k) * r;
|
||
// The outer edge on the lit side, then the terminator back.
|
||
const outer = waxing ? 1 : 0;
|
||
const terminator = waxing ? (k > 0.5 ? 1 : 0) : k > 0.5 ? 0 : 1;
|
||
const d = `M12 ${12 - r}A${r} ${r} 0 0 ${outer} 12 ${12 + r}A${rx} ${r} 0 0 ${terminator} 12 ${12 - r}Z`;
|
||
return (
|
||
<svg className="moon-phase-icon" viewBox="0 0 24 24" aria-hidden="true">
|
||
<circle cx="12" cy="12" r={r} className="moon-dark" />
|
||
<path d={d} className="moon-lit" />
|
||
</svg>
|
||
);
|
||
}
|
||
|
||
/**
|
||
* "Ma: Hold a ♉ Bikában" in the header (the moon calendar behind it). Narrow
|
||
* screens show the phase and the sign's glyph only.
|
||
*/
|
||
export function MoonChip({ sky }: { sky: SkyNow }) {
|
||
const moon = sky.moon;
|
||
const sign = moon.position.sign;
|
||
const where = withArticle(SIGN_IN[sign] ?? sign);
|
||
return (
|
||
<Link
|
||
href="/holdnaptar"
|
||
className="moon-chip"
|
||
aria-label={`Ma a Hold ${where} jár: holdnaptár`}
|
||
>
|
||
<MoonPhaseIcon illumination={moon.illumination} waxing={moon.waxing} />
|
||
<span className="moon-chip-text" aria-hidden="true">
|
||
Ma: Hold {where.split(" ")[0]}{" "}
|
||
</span>
|
||
<span className="moon-chip-glyph sym" aria-hidden="true">
|
||
{SIGNS[sign]?.glyph}
|
||
{"︎"}
|
||
</span>
|
||
<span className="moon-chip-text" aria-hidden="true">
|
||
{" "}
|
||
{SIGN_IN[sign]}
|
||
</span>
|
||
</Link>
|
||
);
|
||
}
|