UNPKG

@activecollab/components

Version:

ActiveCollab Components

34 lines 1.05 kB
import _extends from "@babel/runtime/helpers/esm/extends"; import React, { forwardRef, useContext } from "react"; import classNames from "classnames"; import { EntityGroupContext } from "./EntityGroup"; import { StyledEntityCard } from "./Styles"; import { Card } from "../Card"; export const EntityCard = /*#__PURE__*/forwardRef((_ref, ref) => { let { children, isCollection, background, className, as, ...rest } = _ref; const { renderAs } = useContext(EntityGroupContext); const classSuffix = "c-entity-card-" + renderAs; const paperType = renderAs === "grid" ? "paper-1" : "paper-2"; const Component = as || Card; return /*#__PURE__*/React.createElement(StyledEntityCard, _extends({ as: Component, $renderAs: renderAs, $background: background, variant: paperType, className: classNames("c-entity-card", classSuffix, className), $isCollection: isCollection }, rest, { ref: ref }), children); }); EntityCard.displayName = "EntityCard"; //# sourceMappingURL=EntityCard.js.map