UNPKG

@navikt/ds-react

Version:

React components from the Norwegian Labour and Welfare Administration.

23 lines 1.09 kB
import cl from "clsx"; import { format } from "date-fns"; export const getConditionalClasses = (cropped, direction, status) => { /* Renaming to aksel-* happends where these are used, so no need to rename here */ return cl(`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"), }); }; export const ariaLabel = (startDate, endDate, status, statusLabel, translate) => { const dateFormat = translate("dateFormat"); const start = format(startDate, dateFormat); const end = format(endDate, dateFormat); return translate("Period.period", { status: statusLabel || translate(`Period.${status}`), start, end, }); }; //# sourceMappingURL=period.js.map