// WDCard.tsx 
import React, { Component } from 'react';
import IWDCardState from './IWDCardState'; 
import IWDCardProps from './IWDCardProps';
import WDWidgetBase from '@widgets/WDWidgetBase/WDWidgetBase';
import "./WDCard.css";
import defaultValue from "./WDCardState.json";

export default class WDCard extends WDWidgetBase<React.PropsWithChildren<IWDCardProps>, IWDCardState>{
  
  constructor(props: any) {
    super(props, defaultValue);
    if (this.manualInitState) {
      this.state = {
        ...this.state,
        title: this.props.title ?? ""
      }
    }
    this.receiveEvents = true;
  }

  renderContent() {
       return(
         <div className="WDCard">
          <div className="card mb-2">
            { this.state.title !== "" ? (
            <div className="card-header">
              <h6 className="mb-0">
                {/* <button className="btn btn-link" type="button"> */}
                  {this.state.title}
                {/* </button> */}
              </h6>
            </div>
            ) : ("")}
            <div className="card-body p-1">
              {this.props.children}
            </div>
          </div>
         </div>
       );
     }
}
