"use strict";
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
    if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
    return cooked;
};
var __assign = (this && this.__assign) || Object.assign || function(t) {
    for (var s, i = 1, n = arguments.length; i < n; i++) {
        s = arguments[i];
        for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
            t[p] = s[p];
    }
    return t;
};
var __rest = (this && this.__rest) || function (s, e) {
    var t = {};
    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
        t[p] = s[p];
    if (s != null && typeof Object.getOwnPropertySymbols === "function")
        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
            t[p[i]] = s[p[i]];
    return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
var lodash_1 = require("lodash");
var React = require("react");
var recompose_1 = require("recompose");
var styled_components_1 = require("styled-components");
var asRendition_1 = require("../asRendition");
var utils_1 = require("../utils");
var Divider_1 = require("./Divider");
var Grid_1 = require("./Grid");
var Txt_1 = require("./Txt");
var Wrapper = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\tborder: solid 1px #dfdede;\n\tborder-radius: ", ";\n\tbox-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.14);\n\tpadding: 20px;\n\n\tbackground-color: #ffffff;\n\tmin-height: ", ";\n"], ["\n\tborder: solid 1px #dfdede;\n\tborder-radius: ", ";\n\tbox-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.14);\n\tpadding: 20px;\n\n\tbackground-color: #ffffff;\n\tmin-height: ", ";\n"])), function (props) { return utils_1.px(props.theme.radius || 3); }, function (props) { return props.minHeight || 'auto'; });
var styledDivider = React.createElement(Divider_1.default, { height: 1, color: "#dfdede" });
var Card = function (_a) {
    var title = _a.title, cta = _a.cta, rows = _a.rows, children = _a.children, props = __rest(_a, ["title", "cta", "rows", "children"]);
    var hasHeader = title || cta;
    var Header = hasHeader && (React.createElement(React.Fragment, null,
        React.createElement(Grid_1.Flex, { justify: "space-between", mb: 14 },
            React.createElement(Txt_1.default, { bold: true, fontSize: "16px", color: "#000" }, title),
            cta),
        styledDivider));
    var Rows = rows &&
        lodash_1.map(rows, function (row, index) { return (React.createElement("div", { key: index },
            index > 0 && styledDivider,
            row)); });
    var Body = children && React.createElement(Grid_1.Box, { mt: hasHeader ? 14 : 0 }, children);
    return (React.createElement(Wrapper, __assign({}, props),
        Header,
        Rows,
        Body));
};
exports.default = recompose_1.compose(styled_components_1.withTheme, asRendition_1.default)(Card);
var templateObject_1;
