import Button from '../button';
import ConfigProvider from '../config-provider';
import Icon from '../icon';
import React, { Component } from 'react';
import cls from 'classnames';
import { Card as NextCard } from '@alifd/next';
class BdesignCardMedia extends Component {
    render() {
        const { prefix = 'next-', fullMedia, className } = this.props;
        return (React.createElement(NextCard.Media, Object.assign({ className: cls(className, {
                [`${prefix}full-media`]: fullMedia === true,
            }) }, this.props)));
    }
}
class BdesignCardActions extends Component {
    render() {
        const { prefix = 'next-', className, children, btnActions, onOk, onCancel, okProps, cancelProps, socialActions, onTags, onLike, onShare, } = this.props;
        if (btnActions) {
            return (React.createElement(NextCard.Actions, Object.assign({ className: cls(className, {
                    [`${prefix}card-btn-action-only-ok`]: (Array.isArray(btnActions)
                        ? btnActions.join('')
                        : '') === ['ok'].join(''),
                    [`${prefix}card-btn-action-only-cancel`]: (Array.isArray(btnActions)
                        ? btnActions.join('')
                        : '') === ['cancel'].join(''),
                    [`${prefix}card-btn-action-reverse`]: (Array.isArray(btnActions)
                        ? btnActions.join('')
                        : '') === ['ok', 'cancel'].join(''),
                }) }, this.props),
                React.createElement(Button, { type: "secondary", size: "medium", className: "btn-cancel", onClick: onCancel }, cancelProps ? cancelProps : '取消'),
                React.createElement(Button, { type: "primary", size: "medium", className: "btn-ok", onClick: onOk }, okProps ? okProps : '确认')));
        }
        else if (socialActions) {
            return (React.createElement(NextCard.Actions, { className: cls(className, {
                    [`${prefix}card-social-action`]: true,
                }) },
                React.createElement("div", { className: "cardtags", onClick: onTags },
                    React.createElement(Icon, { type: "Thumbsup-outlined" })),
                React.createElement("div", { className: "cardlike", onClick: onLike },
                    React.createElement(Icon, { type: "Favorite-outlined" })),
                React.createElement("div", { className: "cardshare", onClick: onShare },
                    React.createElement(Icon, { type: "Share-outlined" }))));
        }
        return (React.createElement(NextCard.Actions, Object.assign({}, this.props), children ? children : undefined));
    }
}
class Card extends Component {
    render() {
        const { prefix = 'next-', className, direction } = this.props;
        return (React.createElement(NextCard, Object.assign({}, this.props, { className: cls(className, {
                [`${prefix}card-horizontal`]: direction === 'horizontal',
            }) })));
    }
}
Card.BulletHeader = NextCard.BulletHeader;
Card.CollaspeContent = NextCard.CollaspeContent;
Card.Header = NextCard.Header;
Card.Content = NextCard.Content;
Card.Media = ConfigProvider.config(BdesignCardMedia);
Card.Actions = ConfigProvider.config(BdesignCardActions);
Card.Divider = NextCard.Divider;
export default ConfigProvider.config(Card);
