generated from codersforcauses/django-nextjs-template
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #131 from codersforcauses/issue-129-Create_Bider_C…
…ard_ui_component_for_a_task Create bidder offer card for poster to view
- Loading branch information
Showing
3 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import PersonDetail from "./person-detail"; | ||
|
||
interface BidderOfferProps { | ||
name: string; | ||
profile: string; | ||
price: number; | ||
bio: string; | ||
className?: string; | ||
} | ||
|
||
const MAX_BIO_LENGTH = 86; | ||
function truncate(str: string) { | ||
if (str.length <= MAX_BIO_LENGTH) { | ||
return str; | ||
} | ||
return str.slice(0, MAX_BIO_LENGTH) + "..."; | ||
} | ||
|
||
export default function BidderOfferCard({ | ||
name, | ||
profile, | ||
price, | ||
bio, | ||
className, | ||
}: BidderOfferProps) { | ||
const defaultClassName = "relative m-4 rounded-lg border border-gray-300 p-4"; | ||
return ( | ||
<div className={className ? className : defaultClassName}> | ||
<PersonDetail personName={name} personImg={profile} /> | ||
<div className="absolute right-4 top-6 inline-block font-bold">{`$${price}`}</div> | ||
<p className="text-sm font-medium">{truncate(bio)}</p> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters