@dnb/eufemia
Version:
DNB Eufemia Design System UI Library
46 lines (45 loc) • 1.44 kB
JavaScript
"use client";
var _Hr;
import React, { useContext } from 'react';
import clsx from 'clsx';
import FlexItem from "../flex/Item.js";
import Hr from "../../elements/Hr.js";
import { ListContext } from "./ListContext.js";
import { createSkeletonClass } from "../skeleton/SkeletonHelper.js";
import Context from "../../shared/Context.js";
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
function ItemFooter({
className,
skeleton,
children,
...rest
}) {
var _useContext;
const context = useContext(Context);
const inheritedSkeleton = (_useContext = useContext(ListContext)) === null || _useContext === void 0 ? void 0 : _useContext.skeleton;
const appliedSkeleton = skeleton !== null && skeleton !== void 0 ? skeleton : inheritedSkeleton;
const content = _jsxs(_Fragment, {
children: [_Hr || (_Hr = _jsx(Hr, {
top: false,
bottom: false,
className: "dnb-list__item__footer-separator"
})), _jsx(FlexItem, {
className: clsx('dnb-list__item__footer', className, appliedSkeleton && createSkeletonClass('font', true)),
...rest,
children: children
})]
});
if (appliedSkeleton) {
return _jsx(Context, {
value: {
...context,
skeleton: appliedSkeleton
},
children: content
});
}
return content;
}
ItemFooter._supportsSpacingProps = true;
export default ItemFooter;
//# sourceMappingURL=ItemFooter.js.map