@navikt/ds-react
Version:
React components from the Norwegian Labour and Welfare Administration.
27 lines • 1.29 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ariaLabel = exports.getConditionalClasses = void 0;
const date_fns_1 = require("date-fns");
const helpers_1 = require("../../utils/helpers");
const getConditionalClasses = (cropped, direction, status) => {
return (0, helpers_1.cl)(`aksel-timeline__period aksel-timeline__period--${status}`, {
"aksel-timeline__period--connected-both": cropped === "both",
"aksel-timeline__period--connected-right": (cropped === "right" && direction === "left") ||
(cropped === "left" && direction === "right"),
"aksel-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