import { tag, h, WeElement, extractClass } from 'omi' import * as css from './index.scss' import '../icon' //@ts-ignore import '../theme.ts' interface Props { alt?: string, src?: string, size?: number, square?: boolean, icon?: string, color?: string, backgroundColor?: string } @tag('m-avatar') export default class Avatar extends WeElement{ static css = css static defaultProps = { size: 40, color: 'white', backgroundColor: '#ccc' } static propTypes = { alt: String, src: String, size: Number, square: Boolean, icon: String, color: String, backgroundColor: String } render(props) { return (
{props.icon ? {props.icon} : (props.src ? {props.alt} : props.children ? props.children : this.innerHTML)}
) } }