UNPKG

@navikt/ds-react

Version:

React components from the Norwegian Labour and Welfare Administration.

31 lines 1.52 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.ariaLabel = exports.getConditionalClasses = void 0; const clsx_1 = __importDefault(require("clsx")); const date_fns_1 = require("date-fns"); const getConditionalClasses = (cropped, direction, status) => { /* Renaming to aksel-* happends where these are used, so no need to rename here */ return (0, clsx_1.default)(`navds-timeline__period navds-timeline__period--${status}`, { "navds-timeline__period--connected-both": cropped === "both", "navds-timeline__period--connected-right": (cropped === "right" && direction === "left") || (cropped === "left" && direction === "right"), "navds-timeline__period--connected-left": (cropped === "left" && direction === "left") || (cropped === "right" && direction === "right"), }); }; exports.getConditionalClasses = getConditionalClasses; const ariaLabel = (startDate, endDate, status, statusLabel, translate) => { const dateFormat = translate("dateFormat"); const start = (0, date_fns_1.format)(startDate, dateFormat); const end = (0, date_fns_1.format)(endDate, dateFormat); return translate("Period.period", { status: statusLabel || translate(`Period.${status}`), start, end, }); }; exports.ariaLabel = ariaLabel; //# sourceMappingURL=period.js.map