UNPKG

terriajs

Version:

Geospatial data visualization platform.

21 lines 1.32 kB
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import { useTranslation } from "react-i18next"; import isDefined from "../../../../Core/isDefined"; import * as DTP from "./DateTimePickerStyles"; import { daysInMonth, monthNames } from "./utils"; export const MonthView = ({ year, datesObject, onSelectMonth, onBack }) => { const { t } = useTranslation(); if (!datesObject.dates || datesObject.dates.length <= 12) { return null; } return (_jsxs(DTP.Grid, { children: [_jsx(DTP.GridHeading, { children: _jsx(DTP.BackButton, { title: t("dateTime.back"), onClick: onBack, children: year }) }), _jsx(DTP.GridBody, { children: monthNames.map((m, i) => (_jsxs(DTP.GridRow, { css: ` ${!isDefined(datesObject[i]) ? `:hover { background: transparent; cursor: default; }` : ""} `, onClick: () => isDefined(datesObject[i]) && onSelectMonth(i), children: [_jsx(DTP.GridLabel, { children: m }), _jsx(DTP.GridRowInner, { marginRight: "3", children: daysInMonth(i + 1, year).map((d) => (_jsx(DTP.GridItem, { active: isDefined(datesObject[i]) && isDefined(datesObject[i][d + 1]) }, d))) })] }, m))) })] })); }; //# sourceMappingURL=MonthView.js.map