feat: enhance blog functionality with new components and styles
- Added styles for WordPress table and button blocks in globals.css. - Updated layout.tsx to include a favicon. - Improved blog page layout and search functionality, including new search and filter icons. - Implemented related posts feature in blog post pages with new BlogBlockquote and BlogPullquote components. - Enhanced blog card display with a new variant for smaller cards. - Updated blog collapse sections for better user interaction. - Added new utility functions for extracting block data from WordPress content.
This commit is contained in:
+35
-33
@@ -4,7 +4,7 @@ import { getPosts, getCategories } from "@/lib/wp-api";
|
||||
import { BlogPostCard } from "@/components/blog-post-card";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { ChevronRight, ChevronLeft } from "lucide-react";
|
||||
import { ChevronRight, ChevronLeft, Search, X } from "lucide-react";
|
||||
|
||||
const PER_PAGE = 9;
|
||||
|
||||
@@ -37,7 +37,6 @@ export default async function BlogPage({ searchParams }: BlogPageProps) {
|
||||
getCategories(),
|
||||
]);
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
return (
|
||||
<section className="bg-background pt-32 pb-20 md:pt-40 md:pb-28">
|
||||
<div className="mx-auto max-w-4xl px-6 text-center">
|
||||
@@ -64,53 +63,56 @@ export default async function BlogPage({ searchParams }: BlogPageProps) {
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* Hero + search & filters in one section */}
|
||||
<section className="bg-background pt-32 pb-10 md:pt-40 md:pb-14">
|
||||
<div className="mx-auto max-w-6xl px-6">
|
||||
<div className="text-center space-y-8">
|
||||
<div className="space-y-3">
|
||||
<h1 className="text-4xl font-bold md:text-5xl lg:text-6xl leading-tight tracking-normal">
|
||||
{/* Hero + search & filters — compact */}
|
||||
<section className="bg-background pt-24 pb-6 md:pt-28 md:pb-8">
|
||||
<div className="mx-auto max-w-3xl px-4 sm:px-6">
|
||||
<div className="text-center space-y-5">
|
||||
<div className="space-y-1.5">
|
||||
<h1 className="text-3xl font-bold md:text-4xl tracking-tight">
|
||||
بلاگ
|
||||
</h1>
|
||||
<p className="text-lg md:text-xl leading-relaxed text-muted-foreground max-w-2xl mx-auto">
|
||||
<p className="text-sm md:text-base text-muted-foreground max-w-xl mx-auto">
|
||||
مقالات و مطالب فیپ در زمینه یکپارچهسازی، اتوماسیون و بهرهوری سازمانی.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="flex flex-col gap-5 max-w-2xl mx-auto">
|
||||
<div className="flex flex-col gap-4">
|
||||
<form
|
||||
method="get"
|
||||
action="/blog"
|
||||
className="flex flex-col sm:flex-row gap-2 sm:gap-2 w-full"
|
||||
className="flex gap-2 w-full"
|
||||
>
|
||||
<input type="hidden" name="category" value={categoryId ?? ""} />
|
||||
<Input
|
||||
type="search"
|
||||
name="search"
|
||||
placeholder="جستجو در مطالب..."
|
||||
defaultValue={search}
|
||||
className="flex-1 w-full sm:min-w-[14rem] text-base"
|
||||
aria-label="جستجو در مطالب"
|
||||
/>
|
||||
<div className="flex gap-2 flex-shrink-0">
|
||||
<Button type="submit" size="default" className="flex-1 sm:flex-none">
|
||||
جستجو
|
||||
</Button>
|
||||
{hasFilters && (
|
||||
<Link href="/blog" className="flex-1 sm:flex-none">
|
||||
<Button type="button" variant="outline" size="default" className="w-full">
|
||||
پاک کردن فیلتر
|
||||
</Button>
|
||||
</Link>
|
||||
)}
|
||||
<div className="relative flex-1 flex items-center">
|
||||
<Search className="absolute right-3 size-4 text-muted-foreground pointer-events-none" aria-hidden />
|
||||
<Input
|
||||
type="search"
|
||||
name="search"
|
||||
placeholder="جستجو در مطالب..."
|
||||
defaultValue={search}
|
||||
className="w-full pr-10 pl-3 h-9 text-sm"
|
||||
aria-label="جستجو در مطالب"
|
||||
/>
|
||||
</div>
|
||||
<Button type="submit" size="default" className="h-9 px-4 shrink-0">
|
||||
جستجو
|
||||
</Button>
|
||||
</form>
|
||||
{hasFilters && (
|
||||
<Link
|
||||
href="/blog"
|
||||
className="inline-flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors"
|
||||
>
|
||||
<X className="size-3.5" />
|
||||
پاک کردن فیلتر
|
||||
</Link>
|
||||
)}
|
||||
|
||||
{categories.length > 0 && (
|
||||
<div className="flex flex-wrap items-center justify-center gap-2">
|
||||
<div className="flex flex-wrap items-center justify-center gap-1.5">
|
||||
<Link
|
||||
href="/blog"
|
||||
className={`text-sm rounded-full px-4 py-2 transition-colors ${!categoryId
|
||||
className={`text-xs rounded-full px-3 py-1.5 transition-colors ${!categoryId
|
||||
? "bg-primary text-primary-foreground shadow-sm"
|
||||
: "bg-muted/80 hover:bg-muted text-muted-foreground hover:text-foreground"
|
||||
}`}
|
||||
@@ -121,7 +123,7 @@ export default async function BlogPage({ searchParams }: BlogPageProps) {
|
||||
<Link
|
||||
key={cat.id}
|
||||
href={`/blog${buildQuery({ search, category: String(cat.id), page: 1 })}`}
|
||||
className={`text-sm rounded-full px-4 py-2 transition-colors ${categoryId === cat.id
|
||||
className={`text-xs rounded-full px-3 py-1.5 transition-colors ${categoryId === cat.id
|
||||
? "bg-primary text-primary-foreground shadow-sm"
|
||||
: "bg-muted/80 hover:bg-muted text-muted-foreground hover:text-foreground"
|
||||
}`}
|
||||
|
||||
Reference in New Issue
Block a user