Skip to content

Commit

Permalink
mentions: hover effects only on clickable mentions
Browse files Browse the repository at this point in the history
  • Loading branch information
Puyodead1 committed Dec 9, 2023
1 parent b0e7bb4 commit fc7308d
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/components/markdown/Mention.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,19 @@ import User from "../../stores/objects/User";
import { hexToRGB, rgbToHsl } from "../../utils/Utils";
import UserProfilePopout from "../UserProfilePopout";

const Container = styled.span<{ color?: string }>`
const Container = styled.span<{ color?: string; withHover?: boolean }>`
padding: 0 2px;
border-radius: 4px;
background-color: hsl(${(props) => props.color ?? "var(--primary-hsl)"} / 0.3);
&:hover {
background-color: hsl(${(props) => props.color ?? "var(--primary-hsl)"} / 0.5);
cursor: pointer;
}
${(props) =>
props.withHover &&
`
&:hover {
background-color: hsl(${props.color ?? "var(--primary-hsl)"} / 0.5);
cursor: pointer;
}
`}
`;

interface MentionProps {
Expand Down Expand Up @@ -56,7 +60,7 @@ function UserMention({ id }: MentionProps) {
);

return (
<Container onClick={click} ref={ref}>
<Container onClick={click} ref={ref} withHover>
<span>@{user.username}</span>
</Container>
);
Expand Down Expand Up @@ -86,7 +90,7 @@ function ChannelMention({ id }: MentionProps) {
);

return (
<Container onClick={click}>
<Container onClick={click} withHover>
<span>#{channel.name}</span>
</Container>
);
Expand Down

0 comments on commit fc7308d

Please sign in to comment.