Skip to content

Commit

Permalink
Merge pull request #1181 from akh4rf/testimony-hit-ui
Browse files Browse the repository at this point in the history
Bringing Testimony Hit UI in line with Figma
  • Loading branch information
austinhouck authored Jun 28, 2023
2 parents 5eaea19 + 8c0d5a7 commit 5b4a666
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 9 deletions.
10 changes: 8 additions & 2 deletions components/ProfilePage/StyledProfileComponents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,14 @@ export const StyledContainer = styled(Container)`
width: 100%;
}
.view-edit-profile {
.view-edit-profile,
.follow-button {
width: 100%;
text-decoration: none;
}
.view-edit-profile > button {
.view-edit-profile > button,
.follow-button > button {
width: 100%;
}
Expand All @@ -123,5 +125,9 @@ export const StyledContainer = styled(Container)`
.view-edit-profile > button {
width: auto;
}
.follow-button > button {
width: unset;
}
}
`
31 changes: 27 additions & 4 deletions components/search/testimony/TestimonyHit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { Testimony } from "components/db/testimony"
import { trimContent } from "components/TestimonyCallout/TestimonyCallout"
import { formatBillId } from "components/formatting"
import { useBill } from "components/db/bills"
import { FollowButton } from "components/shared/FollowButton"
import { Image } from "react-bootstrap"

export const TestimonyHit = ({ hit }: { hit: Hit<Testimony> }) => {
const url = maple.testimony({ publishedId: hit.id })
Expand All @@ -28,6 +30,12 @@ const TestimonyResult = ({ hit }: { hit: Hit<Testimony> }) => {
})
const { loading, error, result: bill } = useBill(hit.court, hit.billId)
const committee = bill?.currentCommittee
const isOrg = hit.authorRole === "organization"
const writtenBy = isOrg ? (
<Link href={`/profile?id=${hit.authorUid}`}>{hit.authorDisplayName}</Link>
) : (
hit.authorDisplayName
)
return (
<div
style={{
Expand All @@ -37,10 +45,25 @@ const TestimonyResult = ({ hit }: { hit: Hit<Testimony> }) => {
marginBottom: "0.75rem"
}}
>
<span>
Written by {hit.authorDisplayName}
-- {hit.authorRole}
</span>
<div
style={{
display: "flex",
justifyContent: "space-between",
alignItems: "center",
gap: "10px"
}}
>
<Image
src={isOrg ? "/profile-org-icon.svg" : "/profile-individual-icon.svg"}
alt="profile icon"
height="30px"
width="30px"
/>
<span style={{ flexGrow: 1 }}>
<b>Written by {writtenBy}</b>
</span>
{isOrg && <FollowButton profileid={hit.authorUid} />}
</div>
<hr />
<div style={{ display: "flex", alignItems: "center" }}>
<div style={{ marginRight: "10px" }}>
Expand Down
6 changes: 3 additions & 3 deletions components/shared/FollowButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,16 @@ function FollowOrg({
text: string
}) {
return (
<Col className={`d-flex w-100 justify-content-start`}>
<div>
<div>
<div className="view-edit-profile">
<div className="follow-button">
<Button onClick={clickFunction} className={`btn btn-lg py-1`}>
{text}
{checkmark}
</Button>
</div>
</div>
</Col>
</div>
)
}

Expand Down

1 comment on commit 5b4a666

@vercel
Copy link

@vercel vercel bot commented on 5b4a666 Jun 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.