|
| 1 | +import { |
| 2 | + users, |
| 3 | + star, |
| 4 | + buildingOffice, |
| 5 | + mapPin, |
| 6 | + link, |
| 7 | +} from 'solid-heroicons/outline'; |
| 8 | +import { Icon } from 'solid-heroicons'; |
| 9 | +import { TwitterIcon } from '../Icons'; |
| 10 | +import OrgList from './OrgList'; |
| 11 | + |
| 12 | +const UserProfile = (userProfileProps) => { |
| 13 | + return ( |
| 14 | + <div> |
| 15 | + <img |
| 16 | + src={userProfileProps.avatarUrl} |
| 17 | + alt="Avatar" |
| 18 | + width={260} |
| 19 | + height={260} |
| 20 | + class="rounded-full shadow z-30" |
| 21 | + /> |
| 22 | + <h1 class="mt-2"> |
| 23 | + <div class="text-2xl text-gray-800 font-bold leading-tight"> |
| 24 | + {userProfileProps.name} |
| 25 | + </div> |
| 26 | + <div class="text-xl text-gray-500 font-light"> |
| 27 | + {userProfileProps.username} |
| 28 | + </div> |
| 29 | + </h1> |
| 30 | + <div class="text-gray-800 mt-4">{userProfileProps.bio}</div> |
| 31 | + <div class="text-sm text-gray-600 my-4"> |
| 32 | + <Icon path={users} class="w-4 h-4 mb-0.5 mr-1 inline" /> |
| 33 | + <span class="inline-block"> |
| 34 | + <span class="font-medium text-gray-900"> |
| 35 | + {userProfileProps.followers} |
| 36 | + </span>{' '} |
| 37 | + followers |
| 38 | + </span> |
| 39 | + <span class="mx-1">·</span> |
| 40 | + <span class="inline-block"> |
| 41 | + <span class="font-medium text-gray-900"> |
| 42 | + {userProfileProps.following} |
| 43 | + </span>{' '} |
| 44 | + following |
| 45 | + </span> |
| 46 | + <span class="mx-1">·</span> |
| 47 | + <Icon path={star} class="w-4 h-4 mb-0.5 mr-1 inline" /> |
| 48 | + <span class="inline-block"> |
| 49 | + <span class="font-medium text-gray-900"> |
| 50 | + {userProfileProps.starredRepos} |
| 51 | + </span>{' '} |
| 52 | + </span> |
| 53 | + </div> |
| 54 | + <div class="text-sm text-gray-800 space-y-1"> |
| 55 | + {userProfileProps.company && ( |
| 56 | + <div> |
| 57 | + <Icon path={buildingOffice} class="w-4 h-4 mb-0.5 mr-1 inline" /> |
| 58 | + {userProfileProps.company} |
| 59 | + </div> |
| 60 | + )} |
| 61 | + {userProfileProps.location && ( |
| 62 | + <div> |
| 63 | + <Icon path={mapPin} class="w-4 h-4 mb-0.5 mr-1 inline" /> |
| 64 | + {userProfileProps.location} |
| 65 | + </div> |
| 66 | + )} |
| 67 | + {userProfileProps.websiteUrl && ( |
| 68 | + <div> |
| 69 | + <Icon path={link} class="w-4 h-4 mb-0.5 mr-1 inline" /> |
| 70 | + <a |
| 71 | + class="hover:text-blue-600 hover:underline" |
| 72 | + href={userProfileProps.websiteUrl} |
| 73 | + target="_blank" |
| 74 | + rel="noreferrer" |
| 75 | + > |
| 76 | + {userProfileProps.websiteUrl} |
| 77 | + </a> |
| 78 | + </div> |
| 79 | + )} |
| 80 | + {userProfileProps.twitterUsername && ( |
| 81 | + <div> |
| 82 | + <TwitterIcon class="w-4 h-4 mb-0.5 mr-1 inline" /> |
| 83 | + <a |
| 84 | + class="hover:text-blue-600 hover:underline" |
| 85 | + href={`https:/twitter.com/${userProfileProps.twitterUsername}`} |
| 86 | + target="_blank" |
| 87 | + rel="noreferrer" |
| 88 | + > |
| 89 | + @{userProfileProps.twitterUsername} |
| 90 | + </a> |
| 91 | + </div> |
| 92 | + )} |
| 93 | + </div> |
| 94 | + {userProfileProps.organizations.length > 0 && ( |
| 95 | + <OrgList organizations={userProfileProps.organizations} /> |
| 96 | + )} |
| 97 | + </div> |
| 98 | + ); |
| 99 | +}; |
| 100 | + |
| 101 | +export default UserProfile; |
0 commit comments