Skip to content
This repository has been archived by the owner on Dec 27, 2024. It is now read-only.

Commit

Permalink
add card component
Browse files Browse the repository at this point in the history
  • Loading branch information
donovangg committed Mar 17, 2024
1 parent b1f27e1 commit be88761
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 3 deletions.
44 changes: 44 additions & 0 deletions src/components/ResourceCard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import React from "react";

interface ResourceCardProps {
id: number;
title: string;
link: string;
category: string;
imgSrc: string;
}

const ResourceCard = ({
id,
title,
link,
category,
imgSrc,
}: ResourceCardProps) => {
return (
<div className="max-w-sm bg-zinc-800 rounded overflow-hidden shadow-lg">
<img className="w-full" src={imgSrc} alt="Sunset in the mountains" />
<div className="px-6 py-4">
<div className="font-bold text-xl mb-2">The Coldest Sunset</div>
<p className="text-gray-700 text-base">
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptatibus
quia, nulla! Maiores et perferendis eaque, exercitationem praesentium
nihil.
</p>
</div>
<div className="px-6 pt-4 pb-2">
<span className="inline-block bg-gray-200 rounded-full px-3 py-1 text-sm font-semibold text-gray-700 mr-2 mb-2">
#photography
</span>
<span className="inline-block bg-gray-200 rounded-full px-3 py-1 text-sm font-semibold text-gray-700 mr-2 mb-2">
#travel
</span>
<span className="inline-block bg-gray-200 rounded-full px-3 py-1 text-sm font-semibold text-gray-700 mr-2 mb-2">
#winter
</span>
</div>
</div>
);
};

export default ResourceCard;
18 changes: 15 additions & 3 deletions src/components/ResourceContainer.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import React, { useState, useEffect } from "react";
import ResourceCard from "./ResourceCard";

interface ResourceProps {
link: string;
category: string;
title: string;
id: number;
imgSrc: string;
}

interface ResourceContainerProps {
Expand Down Expand Up @@ -82,14 +84,24 @@ const ResourceContainer = ({ resources }: ResourceContainerProps) => {
// Conditional rendering based on isLoading state
<p>Loading...</p>
) : (
<>
{filteredResources.map((res) => (
<section>
{/* {filteredResources.map((res) => (
<article key={res.id}>
{" "}
<h2 className="text-white">{res.title}</h2>
</article>
))} */}
{filteredResources.map((res) => (
<ResourceCard
key={res.id}
id={res.id}
title={res.title}
link={res.link}
category={res.category}
imgSrc={res.imgSrc}
/>
))}
</>
</section>
)}
</div>
);
Expand Down
5 changes: 5 additions & 0 deletions src/pages/biscuits.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
import Layout from "../layouts/Layout.astro";
---

<Layout title="Biscuits"> Biscuits hops on commentaryu </Layout>

0 comments on commit be88761

Please sign in to comment.