trptk/components/artist/types.ts
2026-02-24 17:14:07 +01:00

25 lines
574 B
TypeScript

import type { SanityImageSource } from "@sanity/image-url";
export type ArtistCardData = {
_id: string;
name?: string;
role?: string;
slug?: string;
image?: SanityImageSource;
};
export type ComposerCardData = {
_id: string;
name?: string;
sortKey?: string;
birthYear?: number;
deathYear?: number;
slug?: string;
image?: SanityImageSource;
};
export function formatYears(birthYear?: number, deathYear?: number): string {
if (birthYear && deathYear) return `${birthYear}\u2013${deathYear}`;
if (birthYear) return `${birthYear}`;
return "";
}