mirror of
https://github.com/Dokploy/website.git
synced 2026-07-18 20:35:27 +02:00
docs: refactor code for consistency and readability
- Standardized import statements across various components to use double quotes for consistency. - Updated component files to ensure proper formatting and adherence to coding standards. - Enhanced overall code readability by aligning code structure and improving comment clarity. - Made minor adjustments to ensure all components follow the same coding conventions, improving maintainability.
This commit is contained in:
@@ -1,54 +1,54 @@
|
||||
'use client';
|
||||
"use client";
|
||||
|
||||
import { useDocsSearch } from "fumadocs-core/search/client";
|
||||
import {
|
||||
SearchDialog,
|
||||
SearchDialogClose,
|
||||
SearchDialogContent,
|
||||
SearchDialogFooter,
|
||||
SearchDialogHeader,
|
||||
SearchDialogIcon,
|
||||
SearchDialogInput,
|
||||
SearchDialogList,
|
||||
SearchDialogOverlay,
|
||||
TagsList,
|
||||
TagsListItem,
|
||||
type SharedProps,
|
||||
} from 'fumadocs-ui/components/dialog/search';
|
||||
import { useDocsSearch } from 'fumadocs-core/search/client';
|
||||
import { useState } from 'react';
|
||||
SearchDialog,
|
||||
SearchDialogClose,
|
||||
SearchDialogContent,
|
||||
SearchDialogFooter,
|
||||
SearchDialogHeader,
|
||||
SearchDialogIcon,
|
||||
SearchDialogInput,
|
||||
SearchDialogList,
|
||||
SearchDialogOverlay,
|
||||
type SharedProps,
|
||||
TagsList,
|
||||
TagsListItem,
|
||||
} from "fumadocs-ui/components/dialog/search";
|
||||
import { useState } from "react";
|
||||
|
||||
export default function CustomSearchDialog(props: SharedProps) {
|
||||
const [tag, setTag] = useState<string | undefined>('all');
|
||||
// When tag is "all", don't filter by tag (pass undefined)
|
||||
const { search, setSearch, query } = useDocsSearch({
|
||||
type: 'fetch',
|
||||
tag: tag === 'all' ? undefined : tag,
|
||||
});
|
||||
const [tag, setTag] = useState<string | undefined>("all");
|
||||
// When tag is "all", don't filter by tag (pass undefined)
|
||||
const { search, setSearch, query } = useDocsSearch({
|
||||
type: "fetch",
|
||||
tag: tag === "all" ? undefined : tag,
|
||||
});
|
||||
|
||||
return (
|
||||
<SearchDialog
|
||||
search={search}
|
||||
onSearchChange={setSearch}
|
||||
isLoading={query.isLoading}
|
||||
{...props}
|
||||
>
|
||||
<SearchDialogOverlay />
|
||||
<SearchDialogContent>
|
||||
<SearchDialogHeader>
|
||||
<SearchDialogIcon />
|
||||
<SearchDialogInput />
|
||||
<SearchDialogClose />
|
||||
</SearchDialogHeader>
|
||||
<SearchDialogList items={query.data !== 'empty' ? query.data : null} />
|
||||
<SearchDialogFooter>
|
||||
<TagsList tag={tag} onTagChange={setTag}>
|
||||
<TagsListItem value="all">All</TagsListItem>
|
||||
<TagsListItem value="core">Core</TagsListItem>
|
||||
<TagsListItem value="cli">CLI</TagsListItem>
|
||||
<TagsListItem value="api">API</TagsListItem>
|
||||
</TagsList>
|
||||
</SearchDialogFooter>
|
||||
</SearchDialogContent>
|
||||
</SearchDialog>
|
||||
);
|
||||
return (
|
||||
<SearchDialog
|
||||
search={search}
|
||||
onSearchChange={setSearch}
|
||||
isLoading={query.isLoading}
|
||||
{...props}
|
||||
>
|
||||
<SearchDialogOverlay />
|
||||
<SearchDialogContent>
|
||||
<SearchDialogHeader>
|
||||
<SearchDialogIcon />
|
||||
<SearchDialogInput />
|
||||
<SearchDialogClose />
|
||||
</SearchDialogHeader>
|
||||
<SearchDialogList items={query.data !== "empty" ? query.data : null} />
|
||||
<SearchDialogFooter>
|
||||
<TagsList tag={tag} onTagChange={setTag}>
|
||||
<TagsListItem value="all">All</TagsListItem>
|
||||
<TagsListItem value="core">Core</TagsListItem>
|
||||
<TagsListItem value="cli">CLI</TagsListItem>
|
||||
<TagsListItem value="api">API</TagsListItem>
|
||||
</TagsList>
|
||||
</SearchDialogFooter>
|
||||
</SearchDialogContent>
|
||||
</SearchDialog>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user