|
1 | 1 | # Primer Avatars |
2 | 2 |
|
3 | | -[](https://www.npmjs.org/package/primer-avatars) |
| 3 | +[](https://www.npmjs.org/package/primer-avatars) |
4 | 4 | [](https://travis-ci.org/primer/primer) |
5 | 5 |
|
6 | 6 | > Avatars are images that users can set as their profile picture. On GitHub, they’re always going to be rounded squares. They can be custom photos, uploaded by users, or generated as Identicons as a placeholder. |
@@ -75,14 +75,62 @@ When you need a larger parent avatar, and a smaller child one, overlaid slightly |
75 | 75 |
|
76 | 76 | ### Avatar stack |
77 | 77 |
|
78 | | -Stacked avatars can be used to show who is participating in thread when there is limited space available. When you hover over the stack, the avatars will reveal themselves. Optimally, you should put no more than 3 avatars in the stack. |
| 78 | +Stacked avatars can be used to show multiple collaborators or participants when there is limited space available. When you hover over the stack, the avatars will reveal themselves. |
79 | 79 |
|
80 | 80 | ```html |
81 | | -<span class="avatar-stack tooltipped tooltipped-s" aria-label="jonrohan, aaronshekey, and josh"> |
82 | | - <img alt="@jonrohan" class="avatar" height="39" alt="jonrohan" src="/jonrohan.png" width="39"> |
83 | | - <img alt="@aaronshekey" class="avatar" height="39" alt="aaronshekey" src="/aaronshekey.png" width="39"> |
84 | | - <img alt="@josh" class="avatar" height="39" alt="josh" src="/josh.png" width="39"> |
85 | | -</span> |
| 81 | +<div class="AvatarStack AvatarStack--three-plus"> |
| 82 | + <div class="AvatarStack-body tooltipped tooltipped-se tooltipped-align-left-1" aria-label="octocat, octocat, and octocat"> |
| 83 | + <img class="avatar" height="20" alt="@octocat" src="https://user-images.githubusercontent.com/334891/29999089-2837c968-9009-11e7-92c1-6a7540a594d5.png" width="20"> |
| 84 | + <img class="avatar" height="20" alt="@octocat" src="https://user-images.githubusercontent.com/334891/29999089-2837c968-9009-11e7-92c1-6a7540a594d5.png" width="20"> |
| 85 | + <img class="avatar" height="20" alt="@octocat" src="https://user-images.githubusercontent.com/334891/29999089-2837c968-9009-11e7-92c1-6a7540a594d5.png" width="20"> |
| 86 | + </div> |
| 87 | +</div> |
| 88 | +``` |
| 89 | + |
| 90 | +Based on the number of avatars in the stack, add these modifier classes: |
| 91 | +- `AvatarStack--two` for 2 avatars. |
| 92 | +- `AvatarStack--three-plus` for 3 or more avatars. |
| 93 | + |
| 94 | +If you have more than three avatars, add a div with the classes `avatar avatar-more` as the third avatar in the stack, as such: |
| 95 | + |
| 96 | +```html |
| 97 | +<div class="AvatarStack AvatarStack--three-plus"> |
| 98 | + <div class="AvatarStack-body tooltipped tooltipped-se tooltipped-align-left-1" aria-label="octocat, octocat, octocat, octocat, and octocat"> |
| 99 | + <img class="avatar" height="20" alt="@octocat" src="https://user-images.githubusercontent.com/334891/29999089-2837c968-9009-11e7-92c1-6a7540a594d5.png" width="20"> |
| 100 | + <img class="avatar" height="20" alt="@octocat" src="https://user-images.githubusercontent.com/334891/29999089-2837c968-9009-11e7-92c1-6a7540a594d5.png" width="20"> |
| 101 | + <div class="avatar avatar-more"></div> |
| 102 | + <img class="avatar" height="20" alt="@octocat" src="https://user-images.githubusercontent.com/334891/29999089-2837c968-9009-11e7-92c1-6a7540a594d5.png" width="20"> |
| 103 | + <img class="avatar" height="20" alt="@octocat" src="https://user-images.githubusercontent.com/334891/29999089-2837c968-9009-11e7-92c1-6a7540a594d5.png" width="20"> |
| 104 | + <img class="avatar" height="20" alt="@octocat" src="https://user-images.githubusercontent.com/334891/29999089-2837c968-9009-11e7-92c1-6a7540a594d5.png" width="20"> |
| 105 | + </div> |
| 106 | +</div> |
| 107 | +``` |
| 108 | + |
| 109 | +You can also link individual avatars. To do this shift the `avatar` class over to the anchor: |
| 110 | + |
| 111 | +```html |
| 112 | +<div class="AvatarStack AvatarStack--two"> |
| 113 | + <div class="AvatarStack-body tooltipped tooltipped-se tooltipped-align-left-1" aria-label="octocat and octocat"> |
| 114 | + <a href="#" class="avatar"> |
| 115 | + <img height="20" alt="@octocat" src="https://user-images.githubusercontent.com/334891/29999089-2837c968-9009-11e7-92c1-6a7540a594d5.png" width="20"> |
| 116 | + </a> |
| 117 | + <a href="#" class="avatar"> |
| 118 | + <img height="20" alt="@octocat" src="https://user-images.githubusercontent.com/334891/29999089-2837c968-9009-11e7-92c1-6a7540a594d5.png" width="20"> |
| 119 | + </a> |
| 120 | + </div> |
| 121 | +</div> |
| 122 | +``` |
| 123 | + |
| 124 | +Use `AvatarStack--right` to right-align the avatar stack. Remember to switch the alignment of tooltips when making this change. |
| 125 | + |
| 126 | +```html |
| 127 | +<div class="AvatarStack AvatarStack--three-plus AvatarStack--right"> |
| 128 | + <div class="AvatarStack-body tooltipped tooltipped-sw tooltipped-align-right-1" aria-label="octocat, octocat, and octocat"> |
| 129 | + <img class="avatar" height="20" alt="@octocat" src="https://user-images.githubusercontent.com/334891/29999089-2837c968-9009-11e7-92c1-6a7540a594d5.png" width="20"> |
| 130 | + <img class="avatar" height="20" alt="@octocat" src="https://user-images.githubusercontent.com/334891/29999089-2837c968-9009-11e7-92c1-6a7540a594d5.png" width="20"> |
| 131 | + <img class="avatar" height="20" alt="@octocat" src="https://user-images.githubusercontent.com/334891/29999089-2837c968-9009-11e7-92c1-6a7540a594d5.png" width="20"> |
| 132 | + </div> |
| 133 | +</div> |
86 | 134 | ``` |
87 | 135 |
|
88 | 136 | ## Circle Badge |
|
0 commit comments