Skip to content

Commit 2e3a752

Browse files
committed
chore: update readme
1 parent 6cbe20e commit 2e3a752

File tree

1 file changed

+34
-19
lines changed

1 file changed

+34
-19
lines changed

README.md

Lines changed: 34 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,29 @@ This is a starter template for building a Next.js application that fetches data
2626

2727
## Overview
2828

29-
### What's included?
30-
31-
- ✅ Type-safe data layer with the WordPress RestAPI
32-
- ✅ Setup for all basic WordPress options: Posts, Pages, Authors, Categories, Tags
33-
- ✅ Easy integration with custom post types and ACF
34-
- ✅ Dynamic routes for Posts and Pages
35-
- ✅ Design system for layout and prose styling ([craft-ds.com](https://craft-ds.com))
36-
- ✅ Filter, Search, and Card components
37-
- ✅ Dynamically rendered sitemap
38-
- ✅ Dynamically generated metadata
39-
- ✅ Responsive Nav and Footer components
40-
- ✅ Site configuration file
41-
- ✅ Menu configuration file
29+
### What's included?
30+
31+
✅ Type-safe data layer with the WordPress RestAPI
32+
33+
✅ Setup for all basic WordPress options: Posts, Pages, Authors, Categories, Tags
34+
35+
✅ Easy integration with custom post types and ACF
36+
37+
✅ Dynamic routes for Posts and Pages
38+
39+
✅ Design system for layout and prose styling ([craft-ds.com](https://craft-ds.com))
40+
41+
✅ Filter, Search, and Card components
42+
43+
✅ Dynamically rendered sitemap
44+
45+
✅ Dynamically generated metadata
46+
47+
✅ Responsive Nav and Footer components
48+
49+
✅ Site configuration file
50+
51+
✅ Menu configuration file
4252

4353
### Important files
4454

@@ -142,7 +152,11 @@ All functions use the custom `WordPressAPIError` class for consistent error hand
142152

143153
```typescript
144154
class WordPressAPIError extends Error {
145-
constructor(message: string, public status: number, public endpoint: string) {
155+
constructor(
156+
message: string,
157+
public status: number,
158+
public endpoint: string,
159+
) {
146160
super(message);
147161
this.name = "WordPressAPIError";
148162
}
@@ -330,6 +344,7 @@ import { SearchInput } from "@/components/posts/search-input";
330344
```
331345

332346
Features:
347+
333348
- Real-time search with 300ms debouncing
334349
- URL-based state management
335350
- Maintains filters while searching
@@ -341,11 +356,13 @@ Features:
341356
The search system is implemented across several layers:
342357

343358
1. **Client-Side Component** (`search-input.tsx`):
359+
344360
- Uses Next.js App Router's URL handling
345361
- Debounced input for better performance
346362
- Maintains search state in URL parameters
347363

348364
2. **Server-Side Processing** (`page.tsx`):
365+
349366
- Handles search parameters server-side
350367
- Combines search with other filters
351368
- Parallel data fetching for better performance
@@ -365,11 +382,11 @@ The following search-related functions are available in `lib/wordpress.ts`:
365382

366383
```typescript
367384
// Search posts with combined filters
368-
getAllPosts({
385+
getAllPosts({
369386
search?: string,
370387
author?: string,
371388
tag?: string,
372-
category?: string
389+
category?: string
373390
})
374391

375392
// Search specific content types
@@ -383,9 +400,7 @@ searchAuthors(query: string)
383400
```typescript
384401
// In your page component
385402
const { search } = await searchParams;
386-
const posts = search
387-
? await getAllPosts({ search })
388-
: await getAllPosts();
403+
const posts = search ? await getAllPosts({ search }) : await getAllPosts();
389404
```
390405

391406
The search functionality automatically updates filters and results as you type, providing a smooth user experience while maintaining good performance through debouncing and server-side rendering.

0 commit comments

Comments
 (0)