add: markdown search feature

This commit is contained in:
h z
2025-01-17 09:20:20 +00:00
parent 3f4669f776
commit 76b298ac8b
4 changed files with 138 additions and 43 deletions

View File

@@ -4,6 +4,7 @@ import PermissionGuard from "../PermissionGuard";
import "./PathNode.css";
import {useDeletePath, useMovePath, usePaths, useUpdatePath} from "../../utils/path-queries";
import {useIndexMarkdown, useMarkdownsByPath, useMoveMarkdown} from "../../utils/markdown-queries";
import MarkdownNode from "./MarkdownNode";
const PathNode = ({ path, isRoot = false }) => {
const [isExpanded, setIsExpanded] = useState(isRoot);
@@ -175,34 +176,10 @@ const PathNode = ({ path, isRoot = false }) => {
))}
{sortedMarkdowns.filter(md => md.title !== "index").map((markdown) => (
<li key={markdown.id}>
<div className="is-clickable field has-addons">
<span className="markdown-name has-text-weight-bold control">
<Link to={`/markdown/${markdown.id}`} className="is-link markdown-node">
{markdown.title}
</Link>
</span>
<PermissionGuard rolesRequired={['admin']}>
<div className="control">
<button
className="button is-small mb-1 move-forward"
style={{ height: "1rem", padding: "0.25rem" }}
onClick={() => handleMoveMarkdown(markdown, "forward")}
type="button"
>
</button>
<button
className="button is-small mb-1 move-backward"
style={{ height: "1rem", padding: "0.25rem" }}
onClick={() => handleMoveMarkdown(markdown, "backward")}
type="button"
>
</button>
</div>
</PermissionGuard>
</div>
</li>
<MarkdownNode
markdown={markdown}
handleMoveMarkdown={handleMoveMarkdown}
/>
))}
</ul>
)}