Last active
November 19, 2023 11:37
-
-
Save DewofyourYouth/7253bc3add418e84c320a7213c0ed32a to your computer and use it in GitHub Desktop.
Not too many props
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*** | |
* @typedef {Object} User - an user object | |
* @property {string} firstName - First name of user | |
* @property {string} lastName - Last name of user | |
* @property {string} email - the user's email | |
* @property {string} company - Name of company | |
* @property {string} department - The department that the user is in | |
* @property {string[]} permissions - An array of strings representing the user's permissions | |
*/ | |
function UserPanel({ user }) { | |
return ( | |
<> | |
<head> | |
<title> | |
{user.company} User Panel || {user.department} Dept. | |
</title> | |
</head> | |
<div id="user-panel"> | |
<h1> | |
Welcome {user.firstName} {user.lastName}! | |
</h1> | |
<p> | |
{(user.permissions.includes("admin") | |
&& user.active) && ( | |
<a href="/admin">Go To Admin</a> | |
)} | |
</p> | |
</div> | |
</> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment