29 lines
881 B
TypeScript
29 lines
881 B
TypeScript
import { PlaceholderText } from "./Facts";
|
||
|
||
export interface MetaLinesProps {
|
||
/** „Online · DE/EN · [Dauer]“ */
|
||
text: string;
|
||
}
|
||
|
||
/**
|
||
* A ledger meta string, one item per line. The DM Mono meta columns are narrow
|
||
* (1.5–2 fr), so a single string breaks mid-separator („Online · DE/EN ·“ /
|
||
* „[Dauer]“, or a line opening with a lone „·“). Splitting on „ · “ keeps every
|
||
* item whole and the separator out of the line breaks.
|
||
*/
|
||
export function MetaLines({ text }: MetaLinesProps) {
|
||
const parts = text.split(/\s+·\s+/).filter((p) => p.length > 0);
|
||
if (parts.length < 2) return <PlaceholderText text={text} />;
|
||
return (
|
||
<>
|
||
{parts.map((part, i) => (
|
||
<span key={`${part}-${i}`} className="block whitespace-nowrap">
|
||
<PlaceholderText text={part} />
|
||
</span>
|
||
))}
|
||
</>
|
||
);
|
||
}
|
||
|
||
export default MetaLines;
|