@wordpress/components
Version:
UI components for WordPress.
35 lines (34 loc) • 916 B
JavaScript
// packages/components/src/card/card-body/hook.ts
import { useMemo } from "@wordpress/element";
import { useContextSystem } from "../../context";
import * as styles from "../styles";
import { useCx } from "../../utils/hooks/use-cx";
import { getPaddingBySize } from "../get-padding-by-size";
function useCardBody(props) {
const {
className,
isScrollable = false,
isShady = false,
size = "medium",
...otherProps
} = useContextSystem(props, "CardBody");
const cx = useCx();
const classes = useMemo(() => cx(
styles.Body,
styles.borderRadius,
getPaddingBySize(size),
isShady && styles.shady,
// This classname is added for legacy compatibility reasons.
"components-card__body",
className
), [className, cx, isShady, size]);
return {
...otherProps,
className: classes,
isScrollable
};
}
export {
useCardBody
};
//# sourceMappingURL=hook.js.map