aboutsummaryrefslogtreecommitdiff
path: root/components/membership.js
blob: 36b3d73d5cbb9b35b619bbfef8ce3cb61938cee1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import { html, Component } from "../lib/index.js";

// XXX: If we were feeling creative we could generate unique colors for
// each item in ISUPPORT CHANMODES. But I am not feeling creative.
const names = {
	"~": "owner",
	"&": "admin",
	"@": "op",
	"%": "halfop",
	"+": "voice",
};

export default function Membership(props) {
	if (!this.props.value) {
		return null;
	}

	const name = names[this.props.value[0]] || "";
	return html`
		<span class="membership ${name}" title=${name}>
			${this.props.value}
		</span>
	`;
}