mirror of
https://github.com/pds-nest/nest.git
synced 2024-11-23 13:34:19 +00:00
25 lines
775 B
JavaScript
25 lines
775 B
JavaScript
import React, { useContext } from "react"
|
|
import Style from "./LoggedInUser.module.css"
|
|
import classNames from "classnames"
|
|
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
|
|
import { faUser } from "@fortawesome/free-solid-svg-icons"
|
|
import ContextLogin from "../contexts/ContextLogin"
|
|
|
|
|
|
export default function LoggedInUser({ children, className, ...props }) {
|
|
const {state} = useContext(ContextLogin);
|
|
|
|
if(!state) {
|
|
return (
|
|
<i className={classNames(Style.LoggedInUser, className)} {...props}>
|
|
Not logged in
|
|
</i>
|
|
)
|
|
}
|
|
|
|
return (
|
|
<b className={classNames(Style.LoggedInUser, className)} {...props}>
|
|
<FontAwesomeIcon icon={faUser}/> {state.username}
|
|
</b>
|
|
)
|
|
}
|