{
const root = html`<div></div>`;
const args = {
author: {
avatarUrl: "https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1576322534005&di=936c748c2c002016040e161504f92ec4&imgtype=0&src=http%3A%2F%2Fwx1.sinaimg.cn%2Fcrop.0.48.1059.595.1000%2F6ed8a358gy1fe5r3oy6r0j20tf0jqtak.jpg",
name: "google"
},
text: "do no evil",
date: "2007"
}
function CommentImg(props) {
return htm`
<img className="Avatar"
src=${props.author.avatarUrl}
alt=${props.author.name}
width=300
/>
`
}
function CommentUserInfo(props) {
return htm`
<div className="UserInfo-name">
${props.author.name}
</div>
`;
}
function CommentText(props) {
return htm`
<div className="Comment-text">
${props.text}
</div>
`;
}
function CommentDate(props) {
return htm`
<div className="Comment-date">
${props.date}
</div>
`;
}
function Comment(props) {
return htm`
<div className="Comment">
<div className="UserInfo">
<${CommentImg} author=${args.author} />
<${CommentUserInfo} author=${args.author} />
</div>
<${CommentText} text=${args.text} />
<${CommentDate} date=${args.date} />
</div>
`;
}
const element = htm`<${Comment} author=${args.author} text=${args.text} date=${args.date} />`
ReactDOM.render(element, root);
return root;
}