Skip to content

Commit d9fef43

Browse files
committed
refactor: add clickable variant to username element
1 parent ba7f08c commit d9fef43

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

src/Message/MessageAuthor.tsx

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,19 @@ function MessageAuthor({
9696
return color > 0 ? `#${color.toString(16).padStart(6, "0")}` : undefined;
9797
}, [isGuildMember, resolveRole, member]);
9898

99+
const clickable = userOnClick !== undefined;
100+
99101
if (onlyShowUsername) {
100102
return (
101103
<Styles.MessageAuthor
102-
clickable
103-
// clickable={userOnClick !== undefined}
104+
clickable={clickable}
104105
{...props}
105106
onClick={() => userOnClick?.(author)}
106107
>
107-
<Styles.Username style={{ color: dominantRoleColor }}>
108+
<Styles.Username
109+
clickable={clickable}
110+
style={{ color: dominantRoleColor }}
111+
>
108112
{displayName}
109113
</Styles.Username>
110114
</Styles.MessageAuthor>
@@ -113,7 +117,7 @@ function MessageAuthor({
113117

114118
return (
115119
<Styles.MessageAuthor
116-
clickable={userOnClick !== undefined}
120+
clickable={clickable}
117121
{...props}
118122
onClick={() => userOnClick?.(author)}
119123
>
@@ -151,9 +155,13 @@ function MessageAuthor({
151155
</Styles.AnimatedAvatar>
152156
)}
153157
</Styles.AnimatedAvatarTrigger>
154-
<Styles.Username style={{ color: dominantRoleColor }}>
158+
<Styles.Username
159+
clickable={clickable}
160+
style={{ color: dominantRoleColor }}
161+
>
155162
{displayName}
156163
</Styles.Username>
164+
157165
{dominantRoleIconRole !== null && (
158166
<RoleIcon role={dominantRoleIconRole} />
159167
)}

src/Message/style/author.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ export const MessageAuthor = styled.withConfig({
1515
true: {
1616
"&:hover": {
1717
cursor: "pointer",
18-
textDecoration: "underline",
1918
},
2019
},
2120
},
@@ -35,6 +34,13 @@ export const Username = styled.withConfig({
3534
lineHeight: `1.375rem`,
3635

3736
variants: {
37+
clickable: {
38+
true: {
39+
"&:hover": {
40+
textDecoration: "underline",
41+
},
42+
},
43+
},
3844
automod: {
3945
true: {
4046
color: theme.colors.automodUsername,

0 commit comments

Comments
 (0)