Skip to content

Commit abd533f

Browse files
authored
Merge pull request #1801 from mertbagt/mobile-committee
limit testimony committee length
2 parents b6b14d3 + 3f89a0a commit abd533f

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

components/search/testimony/TestimonyHit.tsx

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
import { Hit } from "instantsearch.js"
2-
import { maple } from "components/links"
32
import Link from "next/link"
4-
import { Testimony } from "components/db/testimony"
5-
import { trimContent } from "components/TestimonyCallout/TestimonyCallout"
6-
import { formatBillId } from "components/formatting"
7-
import { useBill } from "components/db/bills"
8-
import { FollowUserButton } from "components/shared/FollowButton"
3+
import { useTranslation } from "next-i18next"
94
import { Image } from "react-bootstrap"
10-
import { useFlags } from "components/featureFlags"
5+
import { useMediaQuery } from "usehooks-ts"
6+
117
import { useAuth } from "components/auth"
12-
import { useTranslation } from "next-i18next"
8+
import { useBill } from "components/db/bills"
9+
import { Testimony } from "components/db/testimony"
10+
import { useFlags } from "components/featureFlags"
11+
import { formatBillId, truncateText } from "components/formatting"
12+
import { maple } from "components/links"
13+
import { FollowUserButton } from "components/shared/FollowButton"
14+
import { trimContent } from "components/TestimonyCallout/TestimonyCallout"
1315

1416
export const TestimonyHit = ({ hit }: { hit: Hit<Testimony> }) => {
1517
const url = maple.testimony({ publishedId: hit.id })
@@ -44,6 +46,7 @@ const TestimonyResult = ({ hit }: { hit: Hit<Testimony> }) => {
4446
const { user } = useAuth()
4547
const { followOrg } = useFlags()
4648
const isCurrentUser = user?.uid === hit.authorUid
49+
const isMobile = useMediaQuery("(max-width: 768px)")
4750

4851
return (
4952
<div
@@ -104,7 +107,7 @@ const TestimonyResult = ({ hit }: { hit: Hit<Testimony> }) => {
104107
padding: "5px 10px"
105108
}}
106109
>
107-
{committee.name}
110+
{isMobile ? truncateText(committee.name, 35) : committee.name}
108111
</span>
109112
)}
110113
</div>

0 commit comments

Comments
 (0)