Skip to content

Commit a5db0c1

Browse files
committed
Implement search
1 parent 27409da commit a5db0c1

File tree

45 files changed

+1123
-812
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1123
-812
lines changed

apps/landing/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
22

33
# dependencies
4+
public/search.json
45
/node_modules
56
/.pnp
67
.pnp.*

apps/landing/package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
"type": "module",
55
"private": true,
66
"scripts": {
7-
"dev": "next dev",
8-
"build": "next build",
9-
"start": "next start",
7+
"dev": "node ./script.js && next dev",
8+
"search": "node ./script.js",
9+
"build": "node ./script.js && next build",
10+
"start": "node ./script.js && next start",
1011
"lint": "eslint"
1112
},
1213
"dependencies": {
@@ -29,6 +30,8 @@
2930
"@types/react": "^19",
3031
"@types/react-dom": "^19",
3132
"@types/react-syntax-highlighter": "^15.5.13",
32-
"typescript": "^5"
33+
"typescript": "^5",
34+
"glob": "^11.0.1",
35+
"remark": "^15.0.1"
3336
}
3437
}

apps/landing/script.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { glob, readFile, writeFile } from 'node:fs/promises'
2+
3+
const files = await glob('src/**/*.mdx')
4+
5+
const q = []
6+
for await (const file of files) {
7+
q.push(
8+
readFile(file).then((content) => {
9+
const titleIndex = content.toString().indexOf('#')
10+
return {
11+
text: content.toString().substring(titleIndex),
12+
title: /# (.*)/.exec(content.toString())[1],
13+
url:
14+
'/devup-ui/' +
15+
file
16+
.replace(/src[/\\]app[/\\]\(detail\)[/\\]/, '')
17+
.replace('page.mdx', ''),
18+
}
19+
}),
20+
)
21+
}
22+
23+
const res = await Promise.all(q)
24+
25+
await writeFile('public/search.json', JSON.stringify(res))

apps/landing/src/app/(detail)/docs/api/box/page.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
export const metadata = {
2+
title: "Box",
3+
}
4+
15
# Box
26

37
The `Box` component is a layout primitive that can be used to create any kind of layout.

apps/landing/src/app/(detail)/docs/api/button/page.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
export const metadata = {
2+
title: "Button",
3+
}
4+
15
# Button
26

37
The Button component is a simple button component that can be used to trigger actions.

apps/landing/src/app/(detail)/docs/api/center/page.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
export const metadata = {
2+
title: "Center",
3+
}
4+
15
# Center
26

37
The `Center` component is a layout component that centers its children both vertically and horizontally.

apps/landing/src/app/(detail)/docs/api/css/page.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
export const metadata = {
2+
title: "css",
3+
}
4+
15
# css
26

37
css function is a function that returns a string.

apps/landing/src/app/(detail)/docs/api/flex/page.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
export const metadata = {
2+
title: "Flex",
3+
}
4+
15
# Flex
26

37
The `Flex` component is a layout component that uses flexbox to layout its children.

apps/landing/src/app/(detail)/docs/api/grid/page.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
export const metadata = {
2+
title: "Grid",
3+
}
4+
15
# Grid
26

37
The grid component is a layout component that arranges its children in a grid layout. It supports both fixed and fluid layouts.

apps/landing/src/app/(detail)/docs/api/group-selector/page.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
export const metadata = {
2+
title: "Group Selector",
3+
}
4+
15
# Group Selector
26

37
AThe `group` selector is used to apply styles to a group of elements. It is used to apply styles to a group of elements that are siblings of each other.

0 commit comments

Comments
 (0)