1
Fork 0
mirror of https://github.com/Steffo99/sophon.git synced 2024-12-23 07:14:21 +00:00
sophon/frontend/src/components/ResearchGroupPanel.tsx

41 lines
1.4 KiB
TypeScript
Raw Normal View History

import * as React from "react"
import * as ReactDOM from "react-dom"
import Style from "./ResearchGroupPanel.module.css"
import {Panel, BringAttention as B, Button, Variable} from "@steffo/bluelib-react";
import {FontAwesomeIcon} from "@fortawesome/react-fontawesome";
import {faEnvelope, faEye, faGlobe, faQuestion} from "@fortawesome/free-solid-svg-icons";
import {IconDefinition} from "@fortawesome/fontawesome-svg-core";
2021-09-19 21:49:16 +00:00
import {ResearchGroup} from "../types";
import {UserLink} from "./UserLink";
2021-09-19 22:59:01 +00:00
import {Link} from "./Link";
2021-09-19 21:49:16 +00:00
export function ResearchGroupPanel({owner, name, access, slug}: ResearchGroup): JSX.Element {
2021-09-19 22:59:01 +00:00
let accessIcon: JSX.Element
if(access === "OPEN") {
2021-09-19 22:59:01 +00:00
accessIcon = <FontAwesomeIcon icon={faGlobe} title={"Open"}/>
}
else if(access === "MANUAL") {
2021-09-19 22:59:01 +00:00
accessIcon = <FontAwesomeIcon icon={faEnvelope} title={"Invite-only"}/>
}
else {
2021-09-19 22:59:01 +00:00
accessIcon = <FontAwesomeIcon icon={faQuestion} title={"Unknown"}/>
}
// FIXME: use proper bluelib Anchors
return (
<Panel className={Style.Panel}>
<div className={Style.Access}>
2021-09-19 22:59:01 +00:00
{accessIcon}
</div>
<div className={Style.Name} title={slug}>
2021-09-19 22:59:01 +00:00
<Link href={`/g/${slug}/`}>{name}</Link>
</div>
<div className={Style.Owner}>
Created by <UserLink id={owner}/>
</div>
</Panel>
)
}