mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 19:45:05 +01:00
Create method to add sidebar element
Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
This commit is contained in:
parent
a23e2c361a
commit
0a4f8aff79
@ -1,15 +1,29 @@
|
||||
import { TemplateView } from "../../general/TemplateView.js";
|
||||
import { text } from "../../general/html.js";
|
||||
import { text, classNames, tag } from "../../general/html.js";
|
||||
import { AvatarView } from "../../avatar.js";
|
||||
|
||||
export class RoomInfoView extends TemplateView {
|
||||
|
||||
render(t, vm) {
|
||||
const encryptionString = vm.isEncrypted ? "On" : "Off";
|
||||
return t.div({ className: "RoomInfo" }, [
|
||||
t.div({ className: "RoomAvatar" }, [t.view(new AvatarView(vm, 128))]),
|
||||
t.div({ className: "RoomName" }, [t.h2(vm.name)]),
|
||||
|
||||
t.div({ className: "RoomId" }, [text(vm.roomId)]),
|
||||
t.div({ className: "RoomMemberCount" }, [text(vm.memberCount)]),
|
||||
t.div({ className: "RoomEncryption" }, [vm.isEncrypted ? "Encrypted" : "Not Encrypted"])
|
||||
|
||||
this._createSideBarRow("People", vm.memberCount, { MemberCount: true }),
|
||||
|
||||
this._createSideBarRow("Encryption", encryptionString, { EncryptionStatus: true })
|
||||
]);
|
||||
}
|
||||
|
||||
_createSideBarRow(label, value, labelClass, valueClass) {
|
||||
const labelClassString = classNames({ SidebarLabel: true, ...labelClass });
|
||||
const valueClassString = classNames({ SidebarValue: true, ...valueClass });
|
||||
return tag.div({ className: "SidebarRow" }, [
|
||||
tag.div({ className: labelClassString }, [text(label)]),
|
||||
tag.div({ className: valueClassString }, [text(value)])
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user