import { tag, WeElement, h, extractClass } from 'omi' import * as css from './index.scss' import '../icon-button' //@ts-ignore import '../theme.ts' interface Props { width?: string, img?: string, title: string, subTitle?: string, content: string, buttons?: object, icons?: object, topTitle?: boolean, overImg?: boolean } interface Data { } @tag('m-card') export default class Card extends WeElement{ static css = css static propTypes = { width: String, img: String, title: String, subTitle: String, content: String, buttons: Object, icons: Object, topTitle: Boolean, overImg: Boolean } btnClick = (evt, index) => { this.fire('buttonaction', { index, target: evt.currentTarget }) } iconClick = (evt, index) => { this.fire('iconaction', { index, target: evt.currentTarget, isOn: evt.detail.isOn }) } render(props) { return (
{props.topTitle &&

{props.title}

{props.subTitle &&

{props.subTitle}

}
}
{props.img &&
{props.overImg && !props.topTitle &&

{props.title}

{props.subTitle &&

{props.subTitle}

}
}
} {!props.overImg && !props.topTitle &&

{props.title}

{props.subTitle &&

{props.subTitle}

}
}
{props.content}
{(props.buttons || props.icons) &&
{props.buttons &&
{props.buttons.map((btn, index) => )}
} {props.icons &&
{props.icons.map((icon, index) => { if (typeof icon === 'string') return this.iconClick(_, index)} icon={icon}> return this.iconClick(_, index)} icons={icon}> })}
}
}
) } }