import * as React from "react" ; export interface IconProps { src : string ; size ? : string ; } export function Icon ( props ) { const cname = "Icon" ; const isEmoji = ! /^http/ . test ( props . src ) ; const defaultSize = "1em" ; const style = { width : props . size || defaultSize , height : props . size || defaultSize , } ; if ( isEmoji ) { return < div className = { cname } > { props . src } < /div>; } else { return < img className = { cname } style = { style } src = { props . src } / > ; } }