Archived
add sidebar boilerplate
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
|
||||
const GroupSelect: React.FC = () => {
|
||||
return (
|
||||
<div>GroupSelect</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default GroupSelect;
|
||||
@@ -1,5 +1,20 @@
|
||||
const Sidebar: React.FC = () => {
|
||||
return <span>Sidebar</span>;
|
||||
import { Box } from "@mui/material";
|
||||
import SidebarUser, { SidebarUserObj } from "./SidebarUser";
|
||||
|
||||
interface Props {
|
||||
users: SidebarUserObj[],
|
||||
}
|
||||
|
||||
const Sidebar: React.FC<Props> = ({ users }: Props) => {
|
||||
return (
|
||||
<Box>
|
||||
{users.map((user) => (
|
||||
<div key={user.id}>
|
||||
<SidebarUser user={user} />
|
||||
</div>
|
||||
))}
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
export default Sidebar;
|
||||
export default Sidebar;
|
||||
@@ -0,0 +1,64 @@
|
||||
import { Box } from "@mui/material";
|
||||
|
||||
export interface SidebarUserObj {
|
||||
id: number,
|
||||
name: string,
|
||||
meetingStatus: MeetingStatus;
|
||||
}
|
||||
|
||||
export const enum MeetingStatus {
|
||||
OFFLINE = 0,
|
||||
ONLINE = 1,
|
||||
AWAY = 2,
|
||||
IN_MEETING = 3
|
||||
}
|
||||
|
||||
const getMeetingStatusText = (ms: MeetingStatus): string => {
|
||||
switch (ms) {
|
||||
case MeetingStatus.OFFLINE: {
|
||||
return "Offline";
|
||||
}
|
||||
case MeetingStatus.ONLINE: {
|
||||
return "Online";
|
||||
}
|
||||
case MeetingStatus.AWAY: {
|
||||
return "Away";
|
||||
}
|
||||
case MeetingStatus.IN_MEETING: {
|
||||
return "In meeting";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const getStatusColor = (ms: MeetingStatus): string => {
|
||||
switch (ms) {
|
||||
case MeetingStatus.OFFLINE: {
|
||||
return "#b8b8b8";
|
||||
}
|
||||
case MeetingStatus.ONLINE: {
|
||||
return "#70ff70";
|
||||
}
|
||||
case MeetingStatus.AWAY: {
|
||||
return "#ff7070";
|
||||
}
|
||||
case MeetingStatus.IN_MEETING: {
|
||||
return "#baba34";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
interface Props {
|
||||
user: SidebarUserObj;
|
||||
}
|
||||
|
||||
const SidebarUser: React.FC<Props> = ({ user }: Props) => {
|
||||
return (
|
||||
<Box>
|
||||
{user.name}
|
||||
{getStatusColor(user.meetingStatus)}
|
||||
{getMeetingStatusText(user.meetingStatus)}
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
export default SidebarUser;
|
||||
Reference in New Issue
Block a user