Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Avendaosander/Plataforma-social/llms.txt
Use this file to discover all available pages before exploring further.
CardPost is the primary feed item component displayed on the /home and /home/search pages. It renders a component post with author information, a truncated description, tech stack tag buttons, a preview image, a star rating, and social action icons. The component is a "use client" component that manages local UI state for the follow/unfollow toggle. It is currently built with placeholder data and is ready for API integration once a Post data prop is introduced.
Props
CardPost currently accepts no props. All content is rendered from internal placeholder data. Connecting the component to live data requires refactoring to accept a Post object as a prop — see the API integration note below.
Component Structure
Header
The card header is aflex justify-between row with two groups:
- Left group — a
<Link>to/home/profile/:idthat wraps theUserIcon(sizesize-5) and the username<p>, followed by the follow/unfollowButtonwhosevariantand label switch based on localisFollowingstate (see Follow Toggle below). - Timestamp — a muted
<span>showing relative time (e.g.18hrs), styled withopacity-75, pushed to the right end of the header.
Body
The card body is split into a left content column and a right image column:- Post title — an
<h3>wrapped in a<Link>to/home/post. Bold,text-lg. - Truncated description — a
<p>rendering up to 290 characters of the post description viatruncateText. Overflow is replaced with"...". - Tech stack tags — a row of
Buttoncomponents usingvariant="flat",color="secondary",shape="full",size="sm". Each tag is a<Link>to/home/search?tech=<tag>, enabling filtered search from the feed. - Preview image — a Next.js
<Image>(120×120) in the right column, below which a “Vista Previa”Buttonis displayed.
Footer
The card footer is separated from the body by a top border (border-t border-seagreen-950/40 dark:border-white/40) and contains five elements:
| Element | Detail |
|---|---|
| Star rating | Five StarIcon components — filled stars use fill-yellow-400 stroke-yellow-400, empty stars are unstyled. |
| Numeric rating | A <p> displaying the float rating (e.g. 3.2), styled font-light. |
| Comment count | MessageIcon + a <p> with the count (e.g. 12), font-light. |
| Share action | ShareIcon (size size-5), no label. |
| Bookmark action | BookmarkPlusIcon (size size-5), no label. |
Follow / Unfollow Toggle
The follow state is managed locally withuseState. handleFollowing toggles isFollowing on click. The two states render different Button variants to communicate the current relationship clearly:
- Following (
isFollowing: true) →solid+primary: filled seagreen background, white label “Siguiendo”. - Not following (
isFollowing: false) →outline+primary: transparent background with seagreen ring, label “Seguir”. Dark mode overrides (dark:bg-inherit dark:ring-white dark:text-white) maintain contrast against the card’s transparent dark background.
Text Truncation
The description is truncated using thetruncateText utility defined inside CardPost.tsx. It preserves words up to maxLength characters, then appends "...":
Tailwind Styling
The outer<article> element carries the card’s container styles:
| Property | Light mode | Dark mode |
|---|---|---|
| Background | bg-white | dark:bg-transparent |
| Border | ring-1 ring-seagreen-900 | dark:ring-white |
| Max width | max-w-3xl | — |
| Border radius | rounded-2xl | — |
API Integration
CardPost currently renders hardcoded placeholder data (a lorem ipsum description, a static image, placeholder username, and fixed rating values). To connect it to the GraphQL API, refactor the component signature to accept a Post prop containing the fields below, and replace each placeholder with the corresponding prop value.