-
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.
Update UserAvatar and docs to accept arbitrary props
- Loading branch information
Justin Campbell
committed
Oct 20, 2020
1 parent
8144304
commit f3d742a
Showing
2 changed files
with
26 additions
and
13 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
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 |
|---|---|---|
| @@ -1,23 +1,36 @@ | ||
| 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 displays a graphical representation of a person. | ||
|
|
||
| --- | ||
|
|
||
| The UserAvatar will the first letter of the `userName` prop. | ||
| ## Default Usage | ||
| Used without any props, the UserAvatar will display a generic person icon. | ||
| ```jsx | ||
| import UserAvatar from "./UserAvatar"; | ||
| <UserAvatar userName="Justin Campbell" /> | ||
| ``` | ||
|
|
||
| <UserAvatar /> | ||
| ``` | ||
| ```jsx static | ||
| <UserAvatar userName="Justin Campbell" /> | ||
| <UserAvatar /> | ||
| ``` | ||
|
|
||
| If no value, a null value, or an empty string is passed to the UserAvatar, it will fall back to a generic icon. | ||
| ## With A Name | ||
| If the `name` prop is passed, the UserAvatar will display the first letter of the name. | ||
| ```jsx | ||
| import UserAvatar from "./UserAvatar"; | ||
| <UserAvatar /> | ||
|
|
||
| <UserAvatar name="Jane Doe" /> | ||
| ``` | ||
| ```jsx static | ||
| <UserAvatar name="Jane Doe" /> | ||
| ``` | ||
|
|
||
| ## Other Props | ||
| All props other than `name` are passed to the underlying [MUI Avatar component](https://material-ui.com/api/avatar/). | ||
| ```jsx | ||
| import UserAvatar from "./UserAvatar"; | ||
|
|
||
| <UserAvatar name="Jane Doe" variant="square" /> | ||
| ``` | ||
| ```jsx static | ||
| <UserAvatar /> | ||
| <UserAvatar name="Jane Doe" variant="square" /> | ||
| ``` |