💄 Avatar rhombus

This commit is contained in:
nikolark committed 2022-03-06 13:34:05 +01:00
1 parent 3d91148b7e
commit 7bfa587a77
2 files changed
+17 -5

No files matched your search

+10 -4
View File
@@ -25,16 +25,22 @@
} }
.avatar { .avatar {
/* TODO: clip path */
width: 50px; width: 50px;
height: 50px; height: 50px;
border-radius: 50px; clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
}
.avatarWrap {
filter: drop-shadow(0 0 4px var(--background)) drop-shadow(0 0 11px var(--background))
drop-shadow(0 0 19px var(--background));
} }
.avatar svg { .noAvatar {
display: block;
width: 50px; width: 50px;
height: 50px; height: 50px;
color: #ccc; background-color: black;
clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
content: "";
} }
.name { .name {
+7 -1
View File
@@ -15,10 +15,16 @@ export const UserCard: React.FC<UserCardProps> = ({ user, onUser, active = false
const classes = clsx(styles.user, { [styles.active]: active }); const classes = clsx(styles.user, { [styles.active]: active });
return ( return (
<button className={classes} onClick={onUser} type="button"> <button className={classes} onClick={onUser} type="button">
<div className={styles.avatarWrap}>
{user?.profile?.image && ( {user?.profile?.image && (
<img src={user.profile?.image} alt={`Profile for ${user.firstName}`} className={styles.avatar} /> <img src={user.profile?.image} alt={`Profile for ${user.firstName}`} className={styles.avatar} />
)} )}
{!user?.profile?.image && <span className={styles.avatar}>TODO: NO IMAGE</span>} {!user?.profile?.image && (
<span className={styles.avatar}>
<span className={styles.noAvatar} />
</span>
)}
</div>
<span className={styles.name}>{user?.firstName || "Ekstern"}</span> <span className={styles.name}>{user?.firstName || "Ekstern"}</span>
<span className={styles.balance}>{user?.profile?.balance || ""}</span> <span className={styles.balance}>{user?.profile?.balance || ""}</span>
</button> </button>