Skip to content

Commit 3f89a0a

Browse files
committed
refactor
1 parent 2726099 commit 3f89a0a

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

components/search/testimony/TestimonyHit.tsx

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { useAuth } from "components/auth"
88
import { useBill } from "components/db/bills"
99
import { Testimony } from "components/db/testimony"
1010
import { useFlags } from "components/featureFlags"
11-
import { formatBillId } from "components/formatting"
11+
import { formatBillId, truncateText } from "components/formatting"
1212
import { maple } from "components/links"
1313
import { FollowUserButton } from "components/shared/FollowButton"
1414
import { trimContent } from "components/TestimonyCallout/TestimonyCallout"
@@ -48,13 +48,6 @@ const TestimonyResult = ({ hit }: { hit: Hit<Testimony> }) => {
4848
const isCurrentUser = user?.uid === hit.authorUid
4949
const isMobile = useMediaQuery("(max-width: 768px)")
5050

51-
function limitStringLength35Char(str: string) {
52-
if (str.length > 35) {
53-
return str.substring(0, 35) + "..."
54-
}
55-
return str
56-
}
57-
5851
return (
5952
<div
6053
style={{
@@ -114,9 +107,7 @@ const TestimonyResult = ({ hit }: { hit: Hit<Testimony> }) => {
114107
padding: "5px 10px"
115108
}}
116109
>
117-
{isMobile
118-
? limitStringLength35Char(committee.name)
119-
: committee.name}
110+
{isMobile ? truncateText(committee.name, 35) : committee.name}
120111
</span>
121112
)}
122113
</div>

0 commit comments

Comments
 (0)