import React, { useState } from 'react'; import { IcClock, IcNavArrow } from '../res/icons'; import { splitWeekdayDescriptionLine } from '../utils/placeUtils'; import { useMapStrings } from '../hooks/useMapStrings'; export const HoursCard: React.FC<{ isOpen: boolean; closesAt: string | null; opensNextLabel: string | null; weekdayDescriptions?: string[]; }> = ({ isOpen, closesAt, opensNextLabel, weekdayDescriptions }) => { const [expanded, setExpanded] = useState(false); const s = useMapStrings(); const lines = weekdayDescriptions ?? []; const canExpand = lines.length > 0; return (
{expanded && lines.length > 0 && (
{lines.map((desc, i) => { const { left, right } = splitWeekdayDescriptionLine(desc); return (
{right != null ? ( <> {left} {right} ) : ( {desc} )}
); })}
)}
); };