gamja-old/components/member-list.js

26 lines
614 B
JavaScript
Raw Normal View History

2020-06-26 08:32:56 -04:00
import { html, Component } from "/lib/index.js";
function MemberItem(props) {
function handleClick(event) {
event.preventDefault();
props.onClick();
}
var url = "irc:///" + encodeURIComponent(props.nick) + ",isnick";
return html`
<li>
<a href=${url} class="nick" onClick=${handleClick}>${props.nick}</a>
</li>
`;
}
export default function MemberList(props) {
return html`
2020-06-26 09:16:07 -04:00
<ul>
${Array.from(props.members.entries()).sort().map(([nick, membership]) => html`
2020-06-26 08:32:56 -04:00
<${MemberItem} key=${nick} nick=${nick} membership=${membership} onClick=${() => props.onNickClick(nick)}/>
`)}
</ul>
`;
}