Skip to content

Commit

Permalink
[default-layout] Prettier styling of broken avatar image (#1419)
Browse files Browse the repository at this point in the history
* [default-layout] Prettier styling of broken avatar image

Co-Authored-By: Bjørge Næss <[email protected]>
  • Loading branch information
Kristoffer J. Sivertsen and bjoerge authored Aug 2, 2019
1 parent 921e954 commit ef9443c
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class LoginStatus extends React.PureComponent {
src={user.profileImage}
className={styles.userImage}
alt={`${user.name}'s profile image`}
data-initials={(user.name || user.email || '?').charAt(0)}
/>
) : (
<div className={styles.userImageMissing}>
Expand Down
1 change: 1 addition & 0 deletions packages/@sanity/default-layout/src/components/SideMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ function SideMenu(props) {
className={styles.userProfileImage}
src={user.profileImage}
alt={`${user.name}'s profile image`}
data-initials={user.name ? user.name.charAt(0) : user.email.charAt(0)}
/>
) : (
<div className={styles.userProfileImageMissing}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,18 @@
height: 2.0625em;
width: 2.0625em;
border-radius: 50%;
overflow: hidden;
background-color: var(--preview-placeholder-color);

@nest &:before {
content: attr(data-initials);
text-align: center;
display: block;
line-height: 2em;
margin-bottom: 10px;
text-transform: uppercase;
background-color: var(--preview-placeholder-color);
}
}

.userImageMissing {
Expand Down
11 changes: 11 additions & 0 deletions packages/@sanity/default-layout/src/components/styles/SideMenu.css
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,17 @@
width: 2.0625em;
height: 2.0625em;
border-radius: 50%;
overflow: hidden;
background-color: var(--preview-placeholder-color);

@nest &:before {
content: attr(data-initials);
text-align: center;
display: block;
line-height: 2em;
margin-bottom: 10px;
text-transform: uppercase;
}
}

.userProfileImageMissing {
Expand Down

0 comments on commit ef9443c

Please sign in to comment.