Skip to content

Commit a0adc2b

Browse files
committed
truncate title and description
1 parent f652798 commit a0adc2b

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/components/CrowdFund/list.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { Campaign } from '../../services/airtable';
99
import { CampaignEmptyState } from '../empty-states/campaign';
1010
import fetch from '../../lib/fetch';
1111
import { ShareContext } from '../../services/share';
12+
import { truncateString } from '../../utils';
1213

1314
export const CampaignList = () => {
1415
const { isOpen, openShareDialog } = useContext(ShareContext);
@@ -40,9 +41,15 @@ export const CampaignList = () => {
4041
return (
4142
<li key={item.id} className="mx-0 my-4 md:mx-4">
4243
<Link href="/crowdfund/[slug]" as={`/crowdfund/${item.slug}`}>
43-
<a className="block p-4 px-6 bg-white shadow-lg rounded-lg">
44-
<h3 className="text-xl mb-1 font-medium text-gray-800">{item.title}</h3>
45-
<p className="text-sm mb-4 text-gray-700">{item.short_description}</p>
44+
<a className="block p-4 px-6 bg-white shadow-lg rounded-lg" style={{ maxWidth: 360 }}>
45+
<h3 className="text-xl mb-1 font-medium text-gray-800">
46+
<span className="hidden md:block">{truncateString(item.title, 30)}</span>
47+
<span className="md:hidden">{item.title}</span>
48+
</h3>
49+
<p className="text-sm mb-4 text-gray-700">
50+
<span className="hidden md:block">{truncateString(item.short_description, 45)}</span>
51+
<span className="md:hidden">{item.short_description}</span>
52+
</p>
4653
<CampaignProgress campaign={item} />
4754
<div className="flex justify-between items-center">
4855
<button

0 commit comments

Comments
 (0)