Skip to content

Commit fb9aca1

Browse files
committed
Clean up StrongVerificationBadge CSS
1 parent c097558 commit fb9aca1

4 files changed

Lines changed: 19 additions & 15 deletions

File tree

app/web/components/StrongVerificationBadge.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import { useTranslation } from "i18n";
44
import { GLOBAL } from "i18n/namespaces";
55
import React from "react";
66

7-
const StyledSpan = styled("span")(({ theme }) => ({
8-
display: "inline-block",
7+
const StyledSpan = styled("span")(() => ({
8+
display: "inline-flex",
9+
alignItems: "center",
910
verticalAlign: "middle",
10-
marginLeft: theme.spacing(0.5),
1111
}));
1212

1313
export default function StrongVerificationBadge() {

app/web/components/UserSummary.tsx

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import {
2+
Box,
23
ListItemAvatar,
34
ListItemText,
45
Skeleton,
@@ -17,6 +18,13 @@ import useIsScreenSizeOrSmaller from "utils/useIsScreenSizeOrSmaller";
1718

1819
import StrongVerificationBadge from "./StrongVerificationBadge";
1920

21+
// It could be BlockedUser.AsObject or LiteUser.AsObject and only LiteUser has hasStrongVerification
22+
function isLiteUser(
23+
user: LiteUser.AsObject | BlockedUser.AsObject,
24+
): user is LiteUser.AsObject {
25+
return "hasStrongVerification" in user;
26+
}
27+
2028
const StyledWrapper = styled("div")({
2129
display: "flex",
2230
padding: 0,
@@ -125,16 +133,14 @@ export default function UserSummary({
125133
sx={{ maxWidth: 300 }}
126134
/>
127135
) : (
128-
<>
136+
<Box sx={{ display: "flex", alignItems: "center", gap: 0.5 }}>
129137
{nameOnly
130138
? nameValue
131139
: `${nameValue}${user && "age" in user ? `, ${user.age}` : ""}`}
132-
{user &&
133-
"hasStrongVerification" in user &&
134-
user.hasStrongVerification ? (
140+
{isLiteUser(user) && user.hasStrongVerification && (
135141
<StrongVerificationBadge />
136-
) : null}
137-
</>
142+
)}
143+
</Box>
138144
)}
139145
</Typography>
140146
</Tooltip>

app/web/features/profile/view/UserOverview.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,9 @@ export default function UserOverview({
126126
)}
127127

128128
<StyledWrapper>
129-
<StyledIntro variant="h1">
130-
<span>
131-
{user.name}
132-
{user.hasStrongVerification && <StrongVerificationBadge />}
133-
</span>
129+
<StyledIntro variant="h1" gap={0.5}>
130+
{user.name}
131+
{user.hasStrongVerification && <StrongVerificationBadge />}
134132
</StyledIntro>
135133
<StyledLink
136134
href={routeToUser(user.username)}

app/web/features/search/SeachResultUserCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,9 +292,9 @@ const SearchResultUserCard = ({
292292
}}
293293
>
294294
{user.name}
295-
{user.hasStrongVerification && <StrongVerificationBadge />}
296295
</Typography>
297296
</ProfileLink>
297+
{user.hasStrongVerification && <StrongVerificationBadge />}
298298
</FlexRow>
299299
{!isNativeEmbed && !isMobile && (
300300
<StyledLink

0 commit comments

Comments
 (0)