import Image from "next/image";
import { OTHERS, party, partyVar, partyLabel, partyName } from "@/lib/parties";
import { cls } from "@/lib/format";
/** Logo officiel du parti, jamais déformé ni recoloré. Le PCQ (logo blanc) est posé sur sa pastille marine officielle. */
export function PartyLogo({ id, height = 20, className, white = false }: { id: string | null | undefined; height?: number; className?: string; white?: boolean }) {
const p = party(id);
if (!p) return ;
const width = Math.round(height * p.logoRatio);
const src = white && p.logoWhite ? p.logoWhite : p.logo;
// thème sombre : variante blanche officielle quand elle existe (le marine du PQ disparaît sur fond noir)
const img = p.logoWhite && !white ? (
<>
>
) : (
);
if (p.logoBackdrop && !white) {
return (
{img}
);
}
return {img};
}
/** Pastille sigle + couleur (accessibilité : texte toujours présent). */
export function PartyBadge({ id, className, size = "md" }: { id: string | null | undefined; className?: string; size?: "sm" | "md" | "lg" }) {
const color = partyVar(id);
const label = partyLabel(id);
const sz = size === "sm" ? "text-[10px] px-1.5 py-[2px]" : size === "lg" ? "text-sm px-2.5 py-1" : "text-[11px] px-2 py-[3px]";
return (
{label}
);
}
export function PartyDot({ id, size = 8, className }: { id: string | null | undefined; size?: number; className?: string }) {
return ;
}
export function PartyText({ id, full = false, className }: { id: string | null | undefined; full?: boolean; className?: string }) {
return (
{full ? partyName(id) : partyLabel(id)}
);
}
export { OTHERS };