-
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add sortOrder and type properties to media items
- Loading branch information
1 parent
234e417
commit 18e99af
Showing
7 changed files
with
162 additions
and
39 deletions.
There are no files selected for viewing
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,70 @@ | ||
import React, { forwardRef } from "react"; | ||
import clsx from "clsx"; | ||
import Anchor from "@ui/anchor"; | ||
import { IMedia } from "@utils/types"; | ||
|
||
type TProps = Pick< | ||
IMedia, | ||
"title" | "path" | "type" | "date" | "image" | "views" | ||
> & { | ||
className?: string; | ||
}; | ||
|
||
const MediaCard = forwardRef<HTMLDivElement, TProps>( | ||
({ title, path, type, date, image, views, className }, ref) => { | ||
console.log('Image Source:', image?.src); // Debugging log | ||
return ( | ||
<div | ||
className={clsx( | ||
"media-card tw-flex tw-flex-col tw-relative tw-overflow-hidden tw-transition-all tw-duration-300 tw-rounded tw-bg-white tw-shadow-xl tw-shadow-black/5 tw-group tw-w-[280px] lg:tw-w-[320px] tw-h-auto hover:tw-transform hover:tw-translate-y-[-5px] hover:tw-shadow-2xl", | ||
className | ||
)} | ||
ref={ref} | ||
> | ||
{image?.src ? ( | ||
<figure className="tw-relative tw-overflow-hidden tw-w-full tw-h-[200px] lg:tw-h-[250px]"> | ||
<img | ||
className="tw-w-full tw-h-full tw-transition-transform tw-duration-500 tw-object-cover group-hover:tw-scale-110" | ||
src={image.src} | ||
alt={image?.alt || title} | ||
width={image?.width || 500} | ||
height={image?.height || 250} | ||
loading={image?.loading || "lazy"} | ||
/> | ||
<Anchor path={path} className="link-overlay"> | ||
{title} | ||
</Anchor> | ||
</figure> | ||
) : ( | ||
<div className="tw-bg-dark/40 tw-w-full tw-h-[200px] lg:tw-h-[250px]" /> | ||
)} | ||
|
||
<div className="tw-py-6.1 tw-px-7.5 lg:tw-pt-5 lg:tw-pb-[5px] lg:tw-px-[38px] tw-flex-grow tw-flex tw-flex-col tw-justify-end"> | ||
<Anchor | ||
path={`/${type}`} | ||
className="tw-font-medium tw-block tw-mb-1 -tw-tracking-tightest tw-uppercase tw-text-gray-700 hover:tw-text-gray-900" | ||
> | ||
{type} | ||
</Anchor> | ||
<h3 className="tw-text-xl tw-leading-normal lg:tw-text-[24px] lg:tw-leading-[1.42] tw-text-gray-800 tw-mb-0"> | ||
<Anchor className="hover:tw-text-gray-900" path={path}> | ||
{title} | ||
</Anchor> | ||
</h3> | ||
<ul className="tw-flex tw-gap-7"> | ||
<li className="tw-text-md tw-mt-3.8 tw-text-gray-600 tw-mb-0"> | ||
<i className="far fa-calendar tw-mr-2.5" /> | ||
{date} | ||
</li> | ||
<li className="tw-text-md tw-mt-3.8 tw-text-gray-600"> | ||
<i className="far fa-eye tw-mr-2.5" /> | ||
{views} views | ||
</li> | ||
</ul> | ||
</div> | ||
</div> | ||
); | ||
} | ||
); | ||
|
||
export default MediaCard; |
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
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
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,13 @@ | ||
--- | ||
title: "Media Title 5" | ||
image: "https://res.cloudinary.com/vetswhocode/image/upload/v1716598792/junior-senior-card_sjcshc.jpg" | ||
description: "Description for media " | ||
tags: | ||
- "tag1" | ||
- "tag2" | ||
date: "2023-05-01" | ||
sortOrder: 1 | ||
type: "publication" | ||
slug: "media-one" | ||
--- | ||
Content for media item 5. |
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 |
---|---|---|
|
@@ -6,6 +6,8 @@ tags: | |
- "tag3" | ||
- "tag4" | ||
date: "2023-06-15" | ||
sortOrder: 2 | ||
type: "podcast" | ||
--- | ||
|
||
Content for media item 2. |
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
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