import Link from 'next/link'

export default function LastFiveStories({storyList}: {storyList: any}) {

    return (
    <div className="w-full md:w-1/4 px-4">
        <div className="bg-gray-100 p-4">
            <h2 className="text-xl font-bold text-gray-800 mb-4">Recent Posts</h2>
            <ul className="list-none">
                {storyList.data.map((story: any) => (
                    <li className="mb-2">
                        <Link href="/news/[slug]" as={"/news/" + story.attributes.Slug}>{story.attributes.Title}</Link>
                    </li>
                ))}
            </ul>
        </div>
    </div>
    )
}