Skip to content

Commit fcbcca2

Browse files
code 'like' links
1 parent 038780f commit fcbcca2

File tree

1 file changed

+30
-10
lines changed

1 file changed

+30
-10
lines changed

src/App.tsx

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,18 @@ import { Pagination } from './components/Pagination';
99
import { Footer } from './components/Footer'
1010
import { TooltipProvider } from '@radix-ui/react-tooltip'
1111

12+
interface LikeBlogItem {
13+
title: string;
14+
url: string;
15+
}
1216

1317
interface Blog {
1418
name: string;
1519
url: string;
16-
describe: string;
20+
describe?: string;
1721
avatar: string;
22+
like?: Array<LikeBlogItem>;
23+
feed?: string;
1824
}
1925

2026
const blogs: Blog[] = blogsData as Blog[];
@@ -29,7 +35,7 @@ function Them() {
2935
<div className="grid grid-cols-1 md:grid-cols-3 lg:grid-cols-4 gap-4">
3036
{currentItems.map((blog) => (
3137
<Card key={blog.name} className="w-full">
32-
<div className="flex flex-col items-center justify-center gap-3">
38+
<div className="flex flex-col gap-3">
3339
<div className="w-full relative overflow-hidden rounded-lg">
3440
{/* spacer to create a square box */}
3541
<div className="pb-[100%]"></div>
@@ -44,15 +50,29 @@ function Them() {
4450
</a>
4551
</div>
4652
<div>
47-
<h3 className="text-3xl font-thick">
48-
<a href={blog.url} target="_blank" rel="noopener noreferrer">
53+
<a href={blog.url} target="_blank" rel="noopener noreferrer">
54+
<span className="text-3xl font-thick">
4955
{blog.name}
50-
</a>
51-
</h3>
52-
</div>
53-
<div className="flex flex-col justify-start items-start">
54-
<p className="text-sm text-gray-700">{blog.describe}</p>
56+
{blog.describe !== undefined && <span> / </span>}
57+
</span>
58+
</a>
59+
<span className="text-xl text-gray-700">{blog.describe}</span>
5560
</div>
61+
{blog.like && blog.like.length > 0 && (
62+
<div className="w-full">
63+
<div className='flex flex-col gap-4'>
64+
{blog.like.slice(0, 3).map((item, index) => (
65+
<div key={index}>
66+
<a href={item.url} target="_blank" rel="noopener noreferrer">
67+
<span className='border-2 border-green-300 shadow-2xl rounded-2xl px-3 py-1.5'>
68+
{item.title.length > 25 ? item.title.slice(0, 25) + '...' : item.title}
69+
</span>
70+
</a>
71+
</div>
72+
))}
73+
</div>
74+
</div>
75+
)}
5676
</div>
5777
</Card>
5878
))}
@@ -75,7 +95,7 @@ function App() {
7595
</Tooltip>
7696
</Link>
7797
<Link to="/new">
78-
<Text weight="light" size="5" color='green' className='hover:underline underline-offset-2'>NEW</Text>
98+
<Text weight="light" size="5" color='green' className='hover:underline underline-offset-2'>NEW</Text>
7999
</Link>
80100
</div>
81101
</TooltipProvider>

0 commit comments

Comments
 (0)