Skip to content

Commit 0450304

Browse files
authored
Merge pull request #17 from cocdeshijie/dev
minor fixes
2 parents b6f6fc2 + 72731d0 commit 0450304

File tree

9 files changed

+34
-20
lines changed

9 files changed

+34
-20
lines changed

app/articles/[...slug]/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { allArticles } from "contentlayer/generated";
22
import MDXContent from "@/components/mdx/MDXContent";
33
import { notFound } from "next/navigation";
44
import Comment from "@/components/comment/Comment";
5-
import ArticlesPageHeading from "@/components/ArticlesPageHeading";
5+
import ArticlesPageHeading from "@/components/article/ArticlesPageHeading";
66
import MDXTableOfContents from "@/components/mdx/MDXTableOfContents";
77
import { type Metadata } from "next/types";
88
import { blogConfig } from "@/config";

app/articles/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import ArticleLoader from "@/components/ArticleLoader";
1+
import ArticleLoader from "@/components/article/ArticleLoader";
22
import { allArticles } from "contentlayer/generated";
33
import { compareDesc } from "date-fns";
44
import { blogConfig } from "@/config";

app/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { compareDesc } from "date-fns";
22
import { allArticles } from "contentlayer/generated";
3-
import ArticleLoader from "@/components/ArticleLoader";
3+
import ArticleLoader from "@/components/article/ArticleLoader";
44
import Hero from "@/components/hero/Hero";
55
import { type Metadata } from "next/types";
66
import { blogConfig } from "@/config";

components/Tags.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ type DateTagProps = {
99
export function DateTag({ date }: DateTagProps) {
1010
return (
1111
<div className={"bg-accent_color/50 dark:bg-accent_color-dark/70 rounded-md"}>
12-
<div className={"text-xs py-1 px-2"}>Posted on {format(parseISO(date), 'LLLL d, yyyy')}</div>
12+
<div className={"text-xs py-1 px-2"} suppressHydrationWarning={true}>
13+
Posted on {format(parseISO(date), 'LLLL d, yyyy')}
14+
</div>
1315
</div>
1416
)
1517
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import { useState } from "react";
44
import { Article } from "contentlayer/generated";
5-
import ArticleCard from "@/components/ArticleCard";
5+
import ArticleCard from "@/components/article/ArticleCard";
66
import { cn } from "@/lib/utils";
77
import { useScrollContext } from "@/components/ScrollProgressProvider";
88
import { motion } from "framer-motion";
File renamed without changes.

content-components/link-card/LinkCard.tsx

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
import { cn } from "@/lib/utils";
44
import useSWR from "swr";
5-
import {useState} from "react";
5+
import { RiExternalLinkLine } from "react-icons/ri";
6+
import { useState } from "react";
67

78
type LinkCardProps = {
89
link: string;
@@ -23,20 +24,23 @@ export default function LinkCard({ link }: LinkCardProps) {
2324
"md:w-7/12 h-full",
2425
"backdrop-blur-2xl overflow-hidden bg-slate-50/50 dark:bg-gray-800/70"
2526
)}>
26-
<div className={"h-32 w-32 flex items-center"}>
27-
<div className={"rounded-xl h-full w-full bg-slate-300 dark:bg-slate-500"}></div>
28-
</div>
29-
<div className={"h-32 pl-4 flex-1 flex flex-col space-y-2"}>
27+
<div className={"h-32 pr-4 flex-1 flex flex-col space-y-3"}>
3028
<div className={"flex flex-col space-y-1"}>
3129
<div className={"h-4 bg-slate-400 dark:bg-slate-500 rounded"}></div>
3230
<div className={"h-4 bg-slate-400 dark:bg-slate-500 rounded"}></div>
3331
</div>
3432
<div className={"flex flex-col space-y-1"}>
3533
<div className={"h-3 bg-slate-400 dark:bg-slate-500 rounded"}></div>
3634
<div className={"h-3 bg-slate-400 dark:bg-slate-500 rounded"}></div>
37-
<div className={"h-3 bg-slate-400 dark:bg-slate-500 rounded"}></div>
35+
<div className={"h-3 bg-slate-400 dark:bg-slate-500 rounded hidden md:block"}></div>
36+
</div>
37+
<div className={"flex flex-col space-y-1"}>
38+
<div className={"h-2 bg-slate-400 dark:bg-slate-500 rounded"}></div>
3839
</div>
3940
</div>
41+
<div className={"h-32 w-32 flex items-center"}>
42+
<div className={"rounded-lg h-full w-full bg-slate-300 dark:bg-slate-500"}></div>
43+
</div>
4044
</div>
4145
</div>
4246
)
@@ -46,14 +50,25 @@ export default function LinkCard({ link }: LinkCardProps) {
4650
if (data) return (
4751
<div onMouseEnter={() => setHover(true)}
4852
onMouseLeave={() => setHover(false)}
49-
onClick={() => window.location.href = link}
53+
onClick={() => window.open(link, '_blank')}
5054
style={hover ? {cursor: 'pointer'} : {}}
5155
className={cn(
5256
"flex p-2 mx-auto rounded-xl not-prose",
5357
"md:w-7/12 h-full duration-500",
5458
"backdrop-blur-2xl overflow-hidden bg-slate-50/50 dark:bg-gray-800/70",
5559
{"shadow-lg shadow-primary_color/50 dark:shadow-primary_color-dark/30": hover}
5660
)}>
61+
<div className={"h-32 pr-4 flex-1 flex flex-col space-y-2"}>
62+
<div className={"line-clamp-2 font-bold text-base"}>
63+
{data.ogTitle}
64+
</div>
65+
<p className={"line-clamp-2 md:line-clamp-3 font-light text-sm"}>
66+
{data.ogDescription}
67+
</p>
68+
<p className={"line-clamp-1 font-thin text-xs"}>
69+
{data.ogUrl}
70+
</p>
71+
</div>
5772
<div className={"h-32 w-32 flex items-center"}>
5873
{data.ogImage && data.ogImage[0]?.url ? (
5974
<img className={"h-max w-max mx-auto rounded-lg"}
@@ -65,13 +80,11 @@ export default function LinkCard({ link }: LinkCardProps) {
6580
src={"image-not-found.png"}/>
6681
)}
6782
</div>
68-
<div className={"h-32 pl-4 flex-1 flex flex-col space-y-2"}>
69-
<div className={"line-clamp-2 font-bold text-base"}>
70-
{data.ogTitle}
71-
</div>
72-
<p className={"line-clamp-3 font-light text-sm"}>
73-
{data.ogDescription}
74-
</p>
83+
<div className={"absolute top-2 right-2"}>
84+
<RiExternalLinkLine className={cn(
85+
hover ? "text-primary_color dark:text-primary_color-dark" : "",
86+
"duration-500"
87+
)}/>
7588
</div>
7689
</div>
7790
)

content/pages/link-card.mdx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,3 @@ import LinkCard from "../../content-components/link-card/LinkCard";
1313
<LinkCard link={"https://github.com"}/>
1414

1515

16-

0 commit comments

Comments
 (0)