dynamic news

This commit is contained in:
2025-05-16 11:41:36 +03:00
parent 21498f8f25
commit 8d7be8f829
12 changed files with 130 additions and 31 deletions

View File

@@ -1,18 +1,13 @@
import React from 'react'
import Image from 'next/image'
import Link from 'next/link'
import { news } from '@/app/staticData'
import ShowMore from './ui/ShowMore'
import { NewsProps } from '@/app/types'
interface NewsItem {
id: number
title: string
description: string
image: string
slug: string
}
export default function News() {
const News: React.FC<NewsProps> = ({ news }) => {
if (!news || news.length === 0) {
return null
}
return (
<div className="w-full max-w-[1250px] mx-auto px-4 sm:px-6 mb-20">
<h2 className="text-3xl sm:text-4xl text-center font-bold mb-10">
@@ -33,7 +28,7 @@ export default function News() {
</div>
<div className="pt-6">
<h3 className="text-base font-semibold mb-3">{item.title}</h3>
<ShowMore text={item.description} />
<ShowMore text={item.content} />
</div>
</div>
</Link>
@@ -42,3 +37,5 @@ export default function News() {
</div>
)
}
export default News