-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Justin Campbell
committed
Sep 21, 2020
1 parent
6d9126b
commit e8bd3db
Showing
3 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import React, { useState, useEffect } from "react"; | ||
import PropTypes from "prop-types"; | ||
import { Avatar } from "@material-ui/core"; | ||
|
||
export default function UserAvatar({userName, userAlias}){ | ||
|
||
return( | ||
<Avatar> | ||
{userName === "" ? null : userName.charAt(0)} | ||
</Avatar> | ||
); | ||
}; | ||
|
||
UserAvatar.propTypes = { | ||
/** The name of the user. */ | ||
"userName": PropTypes.string | ||
}; | ||
|
||
UserAvatar.defaultProps = { | ||
"userName": "" | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
The UserAvatar displays a graphical representation of a person and is meant to be used in conjunction with other identifiers like names or emails. | ||
|
||
--- | ||
|
||
The UserAvatar will the first letter of the `userName` prop. | ||
```jsx | ||
import UserAvatar from "./UserAvatar"; | ||
<UserAvatar userName="Justin Campbell" /> | ||
``` | ||
|
||
```jsx static | ||
<UserAvatar userName="Justin Campbell" /> | ||
``` | ||
|
||
If no value, a null value, or an empty string is passed to the UserAvatar, it will fall back to a generic icon. | ||
```jsx | ||
import UserAvatar from "./UserAvatar"; | ||
<UserAvatar /> | ||
``` | ||
|
||
```jsx static | ||
<UserAvatar /> | ||
``` |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import UserAvatar from "./UserAvatar"; | ||
|
||
export default UserAvatar; |