BioDrop
BioDrop copied to clipboard
feat: avatar integration
Fixes Issue
closes #10138
Changes proposed
- Add
getUserAvatar
function for generating user avatar URLs - Created a versatile
Avatar
component that can be utilized throughout the project where user avatars are displayed. The component supports customization options such as size, radius, borders, and link integration for enhanced flexibility and consistency - Introduced a new
AvatarGroup
component to efficiently display groups of avatars with the option to truncate and show more items. This component allows customization of avatar size, border, and border color for each item in the group. It enhances code reusability and provides a flexible solution for avatar display within various contexts across the project - Implemented the
UserAvatarGroup
component to efficiently display avatars of multiple users. This component utilizes the AvatarGroup component internally, providing a convenient way to display user avatars fetched from GitHub using the getUserAvatar function. Each avatar is associated with the user's username, profile picture, and a link to their profile page - avatarize community repos contributor in the repos page
Check List (Check all the applicable boxes)
- [x] My code follows the code style of this project.
- [ ] My change requires changes to the documentation.
- [ ] I have updated the documentation accordingly.
- [x] All new and existing tests passed.
- [x] This PR does not contain plagiarized content.
- [x] The title of my pull request is a short description of the requested changes.
Screenshots
https://github.com/EddieHubCommunity/BioDrop/assets/73095526/e0704b31-6f1d-4b3e-87e2-7b2477ec00b9
dark mode
Step to test
Test Rendering of AvatarGroup: To create a simple test case to render the UserAvatarGroup component and see if it renders without any errors 1.
// Please use the following list of GitHub usernames for testing purposes:
const TEST_GITHUB_USERNAMES = [
"eddiejaoude",
"sarajaoude",
"amandamartin-dev",
"pradumnasaraf",
"dan-mba",
"chinmaymhatre",
"kumarsonsoff3",
"sital002",
"badrivlog",
];
// Replace the `users` prop with the following code when mapping through users:
<AvatarGroup
itemsSize={20}
borderedItems
- items={users.map((username) => ({
+ items={TEST_GITHUB_USERNAMES.map((username) => ({
id: username,
username,
image: getUserAvatar(username),
alt: `Profile picture of ${username}`,
href: `/${username}`,
}))}
/>
- go to
localhost:3000/repos
- ensure that the component renders the avatars correctly with the provided test usernames.
- verify that clicking on each avatar navigates to the correct user profile.
Note to reviewers
Tested everything and it works. Left a few comments over the userRepos.js code changes.
Thank you for testing these changes