UNPKG

@chayns-components/core

Version:

A set of beautiful React components for developing your own applications with chayns.

23 lines 911 B
import React, { useContext, useMemo } from 'react'; import { ContentCardType } from '../../types/contentCard'; import AreaContextProvider, { AreaContext } from '../area-provider/AreaContextProvider'; import { StyledContentCard } from './ContentCard.styles'; const ContentCard = _ref => { let { children, onClick, type = ContentCardType.Default } = _ref; const areaProvider = useContext(AreaContext); const shouldChangeColor = useMemo(() => areaProvider.shouldChangeColor ?? false, [areaProvider.shouldChangeColor]); return /*#__PURE__*/React.createElement(StyledContentCard, { onClick: onClick, $type: type, $shouldChangeColor: shouldChangeColor }, /*#__PURE__*/React.createElement(AreaContextProvider, { shouldChangeColor: !shouldChangeColor }, children)); }; ContentCard.displayName = 'ContentCard'; export default ContentCard; //# sourceMappingURL=ContentCard.js.map