function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
var _excluded = ["title", "variant", "children", "p", "pb", "pl", "pr", "pt", "px", "py"];
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
import React from 'react';
import styled from 'styled-components';
import { Card, Media, Typography } from '../..';
import { Box } from '../../Atoms/Box/Box';
import { isElement } from '../../common/utils';
var StyledCard = styled(Card).withConfig({
  displayName: "CardWithTitle__StyledCard",
  componentId: "sc-1ny6tjx-0"
})(["display:flex;flex-direction:column;max-height:100%;"]);
export var CardWithTitle = function CardWithTitle(props) {
  var title = props.title,
    _props$variant = props.variant,
    variant = _props$variant === void 0 ? 'normal' : _props$variant,
    children = props.children,
    p = props.p,
    pb = props.pb,
    pl = props.pl,
    pr = props.pr,
    pt = props.pt,
    px = props.px,
    py = props.py,
    rest = _objectWithoutProperties(props, _excluded);
  var isBig = variant === 'big';
  return React.createElement(StyledCard, rest, React.createElement(Box, {
    p: p,
    pb: pb !== null && pb !== void 0 ? pb : 2,
    pl: pl,
    pr: pr,
    pt: pt !== null && pt !== void 0 ? pt : 3,
    px: px !== null && px !== void 0 ? px : 3,
    py: py,
    sm: _objectSpread({}, isBig ? {
      pt: pt !== null && pt !== void 0 ? pt : 10,
      px: 10,
      pb: 3
    } : {
      pt: pt !== null && pt !== void 0 ? pt : 4,
      px: 5
    }),
    as: "header"
  }, isElement(title) ? title : React.createElement(React.Fragment, null, React.createElement(Media, {
    query: function query(t) {
      return t.media.greaterThan(t.breakpoints.sm);
    }
  }, React.createElement(Typography, {
    type: isBig ? 'title2' : 'title3',
    weight: "extrabold"
  }, title)), React.createElement(Media, {
    query: function query(t) {
      return t.media.lessThan(t.breakpoints.sm);
    }
  }, React.createElement(Typography, {
    type: "title3",
    weight: "extrabold"
  }, title)))), React.createElement(Box, {
    px: px !== null && px !== void 0 ? px : 3,
    pb: pb !== null && pb !== void 0 ? pb : 5,
    sm: _objectSpread({}, isBig ? {
      px: px !== null && px !== void 0 ? px : 10,
      pb: pb !== null && pb !== void 0 ? pb : 10
    } : {
      px: 5
    })
  }, children));
};
CardWithTitle.displayName = 'CardWithTitle';