change version 1.7.0
This commit is contained in:
22
.vscode/card.code-snippets
vendored
22
.vscode/card.code-snippets
vendored
@@ -2,24 +2,14 @@
|
|||||||
"DocuCards": {
|
"DocuCards": {
|
||||||
"prefix": "card",
|
"prefix": "card",
|
||||||
"body": [
|
"body": [
|
||||||
"<div className=\"grid grid-cols-1 sm:grid-cols-2 gap-4\">",
|
"<CardGroup cols={2}>",
|
||||||
"<Card>",
|
"<Card title=\"${1:Heading2}\" icon=\"${2:Heading2}\">",
|
||||||
" <Card.Title title=\"${1:Heading}\" icon=\"${2:Heading}\" />",
|
" This is an example of card content with columns.",
|
||||||
" <Card.Description description=\"${3:Your description card here! change this text}\" />",
|
|
||||||
"</Card>",
|
"</Card>",
|
||||||
"<Card>",
|
"<Card title=\"${3:Heading3}\" icon=\"${4:Heading3}\">",
|
||||||
" <Card.Title title=\"Link\" icon=\"Link\" />",
|
" This is an example of card content with columns.",
|
||||||
" <Card.Description description=\"Your description card here! change this text\" />",
|
|
||||||
"</Card>",
|
"</Card>",
|
||||||
"<Card>",
|
"</CardGroup>"
|
||||||
" <Card.Title title=\"Images\" icon=\"Images\" />",
|
|
||||||
" <Card.Description description=\"Your description card here! change this text\" />",
|
|
||||||
"</Card>",
|
|
||||||
"<Card>",
|
|
||||||
" <Card.Title title=\"Code Block\" icon=\"Code\" />",
|
|
||||||
" <Card.Description description=\"Your description card here! change this text\" />",
|
|
||||||
"</Card>",
|
|
||||||
"</div>"
|
|
||||||
],
|
],
|
||||||
"description": "Create a DocuCards component on markdown."
|
"description": "Create a DocuCards component on markdown."
|
||||||
}
|
}
|
||||||
|
|||||||
3
.vscode/extensions.json
vendored
3
.vscode/extensions.json
vendored
@@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"recommendations": []
|
|
||||||
}
|
|
||||||
9
.vscode/tooltips.code-snippets
vendored
9
.vscode/tooltips.code-snippets
vendored
@@ -2,14 +2,7 @@
|
|||||||
"DocuTooltips": {
|
"DocuTooltips": {
|
||||||
"prefix": "tooltips",
|
"prefix": "tooltips",
|
||||||
"body": [
|
"body": [
|
||||||
"<div className=\"w-full\">",
|
"${1:What do you know about }<Tooltip text=\"${2:DocuBook}\" tip=\"${3:npx @docubook/create@latest}\" /> ${4:? Create interactive nested documentations using MDX.}",
|
||||||
" <Tooltip tip=\"${1:this is tooltips! DocuBook on version 1.0.5}\">",
|
|
||||||
" <span style={{ textDecoration: \"underline dotted\", cursor: \"pointer\" }}>",
|
|
||||||
" ${2:Hover over me}",
|
|
||||||
" </span>",
|
|
||||||
" </Tooltip>",
|
|
||||||
" <span> ${3:and this is some regular text.}</span>",
|
|
||||||
"</div>"
|
|
||||||
],
|
],
|
||||||
"description": "Create a DocuTooltips component with version examples."
|
"description": "Create a DocuTooltips component with version examples."
|
||||||
}
|
}
|
||||||
|
|||||||
180
CHANGELOG.md
180
CHANGELOG.md
@@ -1,9 +1,183 @@
|
|||||||
|
## [1.7.0] - 2025-02-23
|
||||||
|
|
||||||
|
> Remove the old function in the search dialog and replace it with a new and more optimal feature
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Up and down navigation : search dialog.tsx
|
||||||
|
- Enter (return) to select : search dialog.tsx
|
||||||
|
- Escape to close the dialog : search dialog.tsx
|
||||||
|
|
||||||
|
### Improved
|
||||||
|
|
||||||
|
- Maintenance for anchor components
|
||||||
|
- Anchor.tsx adjustments for all elements that use it
|
||||||
|
|
||||||
|
### Removed
|
||||||
|
|
||||||
|
- Remove suboptimal search features
|
||||||
|
|
||||||
|
## [1.6.0] - 2025-02-21
|
||||||
|
|
||||||
|
> New Feature Card Groups with arrays for more Flexible Content
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Card Groups Components
|
||||||
|
- Props : href to url link
|
||||||
|
- Props : horizontal boolean
|
||||||
|
|
||||||
|
### Improved
|
||||||
|
|
||||||
|
- Card props styling
|
||||||
|
- Compability for Cards components
|
||||||
|
- {children} support for card content
|
||||||
|
|
||||||
|
### Removed
|
||||||
|
|
||||||
|
- remove unused props cards components
|
||||||
|
|
||||||
|
## [1.5.0] - 2025-02-18
|
||||||
|
|
||||||
|
> Minor Update - improved features and responsiveness on all devices
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- New dialog footer on searchbox above @media 768px
|
||||||
|
- Icon X for close dialog on searcbox as esc on medium screen
|
||||||
|
|
||||||
|
### Improved
|
||||||
|
|
||||||
|
- Responsive Leftbar components on large screen
|
||||||
|
- Menu Trigger on medium screen
|
||||||
|
- Responsive Navbar components on medium screen
|
||||||
|
- Better UX for searchbox dialog
|
||||||
|
- tooltips components can be written together with regular paragraphs
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Responsive issue
|
||||||
|
- Compatibility for Bun
|
||||||
|
- Changes postcss.config.js to .cjs for Bun
|
||||||
|
- all CLI installer and updater not working
|
||||||
|
- adjustments for package managers npm, pnpm, bun, yarn
|
||||||
|
|
||||||
|
## [1.4.2] - 2025-02-16
|
||||||
|
|
||||||
|
> Complex Content for Accordion Component props {children}
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- New Props with {children} in accordion
|
||||||
|
- Compatibility for markdown in accordion
|
||||||
|
- Nested components inside an accordion
|
||||||
|
- New icon on note components
|
||||||
|
- add CLI npx @docubook/create@latest
|
||||||
|
- add CLI npx @docubook/update@latest
|
||||||
|
|
||||||
|
### Improved
|
||||||
|
|
||||||
|
- Better UI design for accordion
|
||||||
|
- Styling Note components on markdown
|
||||||
|
- Change accordion output on playground
|
||||||
|
- Change accordion output on snippet
|
||||||
|
|
||||||
|
### Removed
|
||||||
|
|
||||||
|
- Remove depcreated props on accordion
|
||||||
|
- Remove CLI npx update_docu
|
||||||
|
- Remove CLI npx create_docu
|
||||||
|
|
||||||
|
## [1.4.0] - 2025-02-11
|
||||||
|
|
||||||
|
> Floating Button Version with Dynamic Tag {version} on Changelog page
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- New components / changelog floating-version.tsx
|
||||||
|
- Button popover to open version-toc below @media 1024px
|
||||||
|
- Dynamic tag by section ID #version
|
||||||
|
- Dynamic url tag #version
|
||||||
|
- Dynamic version indicator on floating version when scrolling section by ID
|
||||||
|
|
||||||
|
### Improved
|
||||||
|
|
||||||
|
- change icon version history
|
||||||
|
- responsive version-toc
|
||||||
|
- improvement components to changelog page
|
||||||
|
|
||||||
|
## [1.3.8] - 2025-02-08
|
||||||
|
|
||||||
|
> Responsive Table of Content
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Components terminal MagicUI
|
||||||
|
- Components card Shadcn
|
||||||
|
- New mob-toc for a better experience on mobile devices
|
||||||
|
- New Components scroll to top button
|
||||||
|
- Scroll to top :blog-post
|
||||||
|
- Scroll to top :docs-post
|
||||||
|
|
||||||
|
### Improved
|
||||||
|
|
||||||
|
- lib/markdown for generated dynamic toc on markdown
|
||||||
|
- Responsive Table of Content below @media 1024px
|
||||||
|
- Improve docs page
|
||||||
|
|
||||||
|
## [1.3.6] - 2025-02-01
|
||||||
|
|
||||||
|
> Appears more modern editor for Docu Play
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- Line Number for editor
|
||||||
|
- editor.css
|
||||||
|
|
||||||
|
### Improved
|
||||||
|
|
||||||
|
- Better Design for Editor
|
||||||
|
- Similar to Github Editor
|
||||||
|
- Moved Handler Element (copy, download, reset and fullscreen) on Header
|
||||||
|
|
||||||
|
## [1.3.5] - 2025-01-30
|
||||||
|
|
||||||
|
> it's Easy to Write Markdown with Playground
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- New Playground Page
|
||||||
|
- New Playground Layout
|
||||||
|
- Toolbar for Markdown Components
|
||||||
|
- Fullscreen Mode to Focus Editing Your Content
|
||||||
|
- Copy to Clipboard Your Content
|
||||||
|
- Download Your Content as index.mdx
|
||||||
|
- Reset Your Content without refresh the Browser
|
||||||
|
- Only Large Screen for Better Experience
|
||||||
|
|
||||||
|
## [1.3.1] - 2025-01-20
|
||||||
|
|
||||||
|
> Snippet Feature to Easily Write Markdown and Call DocuBook Components
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- New Feature Snippet for Markdown Components
|
||||||
|
- Support Snippet for Visual Studio Code
|
||||||
|
|
||||||
|
### Removed
|
||||||
|
|
||||||
|
- remove props icon and props description for accordion components
|
||||||
|
|
||||||
## [1.3.0] - 2024-12-31
|
## [1.3.0] - 2024-12-31
|
||||||
|
|
||||||
> Release Note Feature to Make it Easier to Write Changelogs
|
> Release Note Feature to Make it Easier to Write Changelogs
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- New Release Note Feature
|
- New Release Note Feature
|
||||||
@@ -48,7 +222,7 @@
|
|||||||
|
|
||||||
## [1.1.0] - 2024-12-15
|
## [1.1.0] - 2024-12-15
|
||||||
|
|
||||||
> Major Update : Easily manage set up with docu.json
|
> Minor Update : Easily manage set up with docu.json
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
|
|||||||
@@ -287,16 +287,10 @@ export default function PlaygroundPage() {
|
|||||||
Content for step 2
|
Content for step 2
|
||||||
</StepperItem>
|
</StepperItem>
|
||||||
</Stepper>\n`,
|
</Stepper>\n`,
|
||||||
card: `<div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
card: `<Card title="Click on me" icon="Link" href="/docs/getting-started/components/button">
|
||||||
<Card>
|
This is how you use a card with an icon and a link. Clicking on this card
|
||||||
<Card.Title title="Heading" icon="Heading" />
|
brings you to the Card Group page.
|
||||||
<Card.Description description="Your description card here! change this text" />
|
</Card>\n`,
|
||||||
</Card>
|
|
||||||
<Card>
|
|
||||||
<Card.Title title="Link" icon="Link" />
|
|
||||||
<Card.Description description="Your description card here! change this text" />
|
|
||||||
</Card>
|
|
||||||
</div>\n`,
|
|
||||||
button: `<Button
|
button: `<Button
|
||||||
text="Click Me"
|
text="Click Me"
|
||||||
href="#"
|
href="#"
|
||||||
@@ -311,9 +305,7 @@ export default function PlaygroundPage() {
|
|||||||
3. number three
|
3. number three
|
||||||
</Accordion>\n`,
|
</Accordion>\n`,
|
||||||
youtube: `<Youtube videoId="your-video-id" />\n`,
|
youtube: `<Youtube videoId="your-video-id" />\n`,
|
||||||
tooltip: `<Tooltip tip="Your tooltip text">
|
tooltip: `What do you know about <Tooltip text="DocuBook" tip="npx @docubook/create@latest" /> ? Create interactive nested documentations using MDX.\n`,
|
||||||
<span>Hover over me</span>
|
|
||||||
</Tooltip>\n`,
|
|
||||||
tabs: `<Tabs defaultValue="tab1" className="pt-5 pb-1">
|
tabs: `<Tabs defaultValue="tab1" className="pt-5 pb-1">
|
||||||
<TabsList>
|
<TabsList>
|
||||||
<TabsTrigger value="tab1">Tab 1</TabsTrigger>
|
<TabsTrigger value="tab1">Tab 1</TabsTrigger>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { usePathname } from "next/navigation";
|
import { usePathname } from "next/navigation";
|
||||||
import { ComponentProps } from "react";
|
import { ComponentProps, forwardRef } from "react";
|
||||||
|
|
||||||
type AnchorProps = ComponentProps<typeof Link> & {
|
type AnchorProps = ComponentProps<typeof Link> & {
|
||||||
absolute?: boolean;
|
absolute?: boolean;
|
||||||
@@ -11,28 +11,28 @@ type AnchorProps = ComponentProps<typeof Link> & {
|
|||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function Anchor({
|
const Anchor = forwardRef<HTMLAnchorElement, AnchorProps>(
|
||||||
absolute,
|
({ absolute, className = "", activeClassName = "", disabled, children, ...props }, ref) => {
|
||||||
className = "",
|
const path = usePathname();
|
||||||
activeClassName = "",
|
let isMatch = absolute
|
||||||
disabled,
|
? props.href.toString().split("/")[1] == path.split("/")[1]
|
||||||
children,
|
: path === props.href;
|
||||||
...props
|
|
||||||
}: AnchorProps) {
|
|
||||||
const path = usePathname();
|
|
||||||
let isMatch = absolute
|
|
||||||
? props.href.toString().split("/")[1] == path.split("/")[1]
|
|
||||||
: path === props.href;
|
|
||||||
|
|
||||||
if (props.href.toString().includes("http")) isMatch = false;
|
if (props.href.toString().includes("http")) isMatch = false;
|
||||||
|
|
||||||
|
if (disabled)
|
||||||
|
return (
|
||||||
|
<div className={cn(className, "cursor-not-allowed")}>{children}</div>
|
||||||
|
);
|
||||||
|
|
||||||
if (disabled)
|
|
||||||
return (
|
return (
|
||||||
<div className={cn(className, "cursor-not-allowed")}>{children}</div>
|
<Link ref={ref} className={cn(className, isMatch && activeClassName)} {...props}>
|
||||||
|
{children}
|
||||||
|
</Link>
|
||||||
);
|
);
|
||||||
return (
|
}
|
||||||
<Link className={cn(className, isMatch && activeClassName)} {...props}>
|
);
|
||||||
{children}
|
// ✅ Tambahkan display name agar tidak error saat build
|
||||||
</Link>
|
Anchor.displayName = "Anchor";
|
||||||
);
|
|
||||||
}
|
export default Anchor;
|
||||||
|
|||||||
@@ -1,57 +1,41 @@
|
|||||||
import React, { ReactNode } from "react";
|
import React, { ReactNode } from "react";
|
||||||
import * as Icons from "lucide-react";
|
import * as Icons from "lucide-react";
|
||||||
|
import Link from "next/link";
|
||||||
|
import clsx from "clsx";
|
||||||
|
|
||||||
type IconName = keyof typeof Icons;
|
type IconName = keyof typeof Icons;
|
||||||
|
|
||||||
// Props untuk Card utama
|
|
||||||
interface CardProps {
|
interface CardProps {
|
||||||
children: ReactNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Props untuk CardTitle
|
|
||||||
interface CardTitleProps {
|
|
||||||
title: string;
|
title: string;
|
||||||
icon?: IconName; // Properti ikon berupa nama ikon yang valid
|
icon?: IconName;
|
||||||
|
href?: string;
|
||||||
|
horizontal?: boolean;
|
||||||
|
children: ReactNode;
|
||||||
|
className?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Props untuk CardDescription
|
const Card: React.FC<CardProps> = ({ title, icon, href, horizontal, children, className }) => {
|
||||||
interface CardDescriptionProps {
|
const Icon = icon ? (Icons[icon] as React.FC<{ className?: string }>) : null;
|
||||||
description: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Komponen Card Utama
|
const content = (
|
||||||
const Card: React.FC<CardProps> & {
|
<div
|
||||||
Title: React.FC<CardTitleProps>;
|
className={clsx(
|
||||||
Description: React.FC<CardDescriptionProps>;
|
"border rounded-lg shadow-sm p-4 transition-all duration-200 bg-white dark:bg-gray-900",
|
||||||
} = ({ children }) => {
|
"hover:bg-gray-50 dark:hover:bg-gray-800",
|
||||||
return (
|
"flex gap-2",
|
||||||
<div className="border rounded-lg shadow-md overflow-hidden py-4 px-8">
|
horizontal ? "flex-row items-center gap-1" : "flex-col space-y-1",
|
||||||
{children}
|
className
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{Icon && <Icon className="w-5 h-5 text-primary flex-shrink-0" />}
|
||||||
|
<div className="flex-1 min-w-0 my-auto h-full">
|
||||||
|
<span className="text-base font-semibold">{title}</span>
|
||||||
|
<div className="text-sm text-gray-600 dark:text-gray-400 -mt-3">{children}</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
return href ? <Link className="no-underline block" href={href}>{content}</Link> : content;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Komponen Card Title
|
|
||||||
Card.Title = ({ title, icon }: CardTitleProps) => {
|
|
||||||
const Icon = icon ? (Icons[icon] as React.FC<{ className?: string }>) : null; // Tipe eksplisit sebagai React.FC
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className="flex flex-col space-y-1">
|
|
||||||
{Icon && <Icon className="text-xl text-primary" />} {/* Render ikon jika ada */}
|
|
||||||
<h2 className="text-xl font-bold">{title}</h2>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
// Menambahkan displayName untuk Card.Title
|
|
||||||
Card.Title.displayName = "CardTitle";
|
|
||||||
|
|
||||||
// Komponen Card Description
|
|
||||||
Card.Description = ({ description }: CardDescriptionProps) => (
|
|
||||||
<p className="text-muted-foreground text-[16.5px] mt-2">{description}</p>
|
|
||||||
);
|
|
||||||
|
|
||||||
// Menambahkan displayName untuk Card.Description
|
|
||||||
Card.Description.displayName = "CardDescription";
|
|
||||||
|
|
||||||
export default Card;
|
export default Card;
|
||||||
|
|||||||
28
components/markdown/cardgroup.tsx
Normal file
28
components/markdown/cardgroup.tsx
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
import React, { ReactNode } from "react";
|
||||||
|
import clsx from "clsx";
|
||||||
|
|
||||||
|
interface CardGroupProps {
|
||||||
|
children: ReactNode;
|
||||||
|
cols?: number;
|
||||||
|
className?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const CardGroup: React.FC<CardGroupProps> = ({ children, cols = 2, className }) => {
|
||||||
|
const cardsArray = React.Children.toArray(children); // Pastikan children berupa array
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className={clsx(
|
||||||
|
"grid gap-4",
|
||||||
|
`grid-cols-1 sm:grid-cols-${cols}`,
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{cardsArray.map((card, index) => (
|
||||||
|
<div key={index}>{card}</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default CardGroup;
|
||||||
@@ -1,30 +1,27 @@
|
|||||||
'use client';
|
"use client";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
|
|
||||||
interface TooltipProps {
|
interface TooltipProps {
|
||||||
tip: string; // Teks yang akan ditampilkan dalam tooltip
|
text: string;
|
||||||
children: React.ReactNode; // Elemen yang akan memunculkan tooltip
|
tip: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Tooltip: React.FC<TooltipProps> = ({ tip, children }) => {
|
const Tooltip: React.FC<TooltipProps> = ({ text, tip }) => {
|
||||||
const [visible, setVisible] = useState(false);
|
const [visible, setVisible] = useState(false);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<span
|
||||||
className="relative inline-block"
|
className="relative inline-block cursor-pointer underline decoration-dotted text-blue-500"
|
||||||
onMouseEnter={() => setVisible(true)}
|
onMouseEnter={() => setVisible(true)}
|
||||||
onMouseLeave={() => setVisible(false)}
|
onMouseLeave={() => setVisible(false)}
|
||||||
>
|
>
|
||||||
{children}
|
{text}
|
||||||
{visible && (
|
{visible && (
|
||||||
<div
|
<span className="absolute bottom-full left-1/2 -translate-x-1/2 mb-2 w-max max-w-xs sm:max-w-sm md:max-w-md lg:max-w-lg xl:max-w-xl bg-background text-foreground text-sm p-2 rounded shadow-md break-words text-center outline outline-1 outline-offset-2">
|
||||||
className="absolute bottom-12 bg-black border-solid-2 border border-white text-white text-sm px-2 py-1 rounded"
|
|
||||||
style={{ whiteSpace: "nowrap" }}
|
|
||||||
>
|
|
||||||
{tip}
|
{tip}
|
||||||
</div>
|
</span>
|
||||||
)}
|
)}
|
||||||
</div>
|
</span>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { ArrowUpIcon, ArrowDownIcon, CommandIcon, FileIcon, SearchIcon, CornerDownLeftIcon } from "lucide-react";
|
import { useRouter } from "next/navigation";
|
||||||
|
import { useEffect, useMemo, useState } from "react";
|
||||||
|
import { ArrowUpIcon, ArrowDownIcon, CommandIcon, FileTextIcon, SearchIcon, CornerDownLeftIcon } from "lucide-react";
|
||||||
import { Input } from "@/components/ui/input";
|
import { Input } from "@/components/ui/input";
|
||||||
import {
|
import {
|
||||||
Dialog,
|
Dialog,
|
||||||
@@ -11,14 +13,15 @@ import {
|
|||||||
DialogClose,
|
DialogClose,
|
||||||
DialogTitle,
|
DialogTitle,
|
||||||
} from "@/components/ui/dialog";
|
} from "@/components/ui/dialog";
|
||||||
import { useEffect, useMemo, useState } from "react";
|
|
||||||
import Anchor from "./anchor";
|
import Anchor from "./anchor";
|
||||||
import { advanceSearch, cn } from "@/lib/utils";
|
import { advanceSearch, cn } from "@/lib/utils";
|
||||||
import { ScrollArea } from "@/components/ui/scroll-area";
|
import { ScrollArea } from "@/components/ui/scroll-area";
|
||||||
|
|
||||||
export default function Search() {
|
export default function Search() {
|
||||||
|
const router = useRouter();
|
||||||
const [searchedInput, setSearchedInput] = useState("");
|
const [searchedInput, setSearchedInput] = useState("");
|
||||||
const [isOpen, setIsOpen] = useState(false);
|
const [isOpen, setIsOpen] = useState(false);
|
||||||
|
const [selectedIndex, setSelectedIndex] = useState(0);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const handleKeyDown = (event: KeyboardEvent) => {
|
const handleKeyDown = (event: KeyboardEvent) => {
|
||||||
@@ -40,6 +43,41 @@ export default function Search() {
|
|||||||
[searchedInput]
|
[searchedInput]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setSelectedIndex(0);
|
||||||
|
}, [filteredResults]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const handleNavigation = (event: KeyboardEvent) => {
|
||||||
|
if (!isOpen || filteredResults.length === 0) return;
|
||||||
|
|
||||||
|
if (event.key === "ArrowDown") {
|
||||||
|
event.preventDefault();
|
||||||
|
setSelectedIndex((prev) => (prev + 1) % filteredResults.length);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.key === "ArrowUp") {
|
||||||
|
event.preventDefault();
|
||||||
|
setSelectedIndex((prev) => (prev - 1 + filteredResults.length) % filteredResults.length);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event.key === "Enter") {
|
||||||
|
event.preventDefault();
|
||||||
|
const selectedItem = filteredResults[selectedIndex];
|
||||||
|
if (selectedItem) {
|
||||||
|
router.push(`/docs${selectedItem.href}`);
|
||||||
|
setIsOpen(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
window.addEventListener("keydown", handleNavigation);
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
window.removeEventListener("keydown", handleNavigation);
|
||||||
|
};
|
||||||
|
}, [isOpen, filteredResults, selectedIndex, router]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Dialog
|
<Dialog
|
||||||
@@ -82,53 +120,54 @@ export default function Search() {
|
|||||||
)}
|
)}
|
||||||
<ScrollArea className="max-h-[400px] overflow-y-auto">
|
<ScrollArea className="max-h-[400px] overflow-y-auto">
|
||||||
<div className="flex flex-col items-start overflow-y-auto sm:px-2 px-1 pb-4">
|
<div className="flex flex-col items-start overflow-y-auto sm:px-2 px-1 pb-4">
|
||||||
{filteredResults.map((item) => {
|
{filteredResults.map((item, index) => {
|
||||||
const level = (item.href.split("/").slice(1).length -
|
const level = (item.href.split("/").slice(1).length - 1) as keyof typeof paddingMap;
|
||||||
1) as keyof typeof paddingMap;
|
|
||||||
const paddingClass = paddingMap[level];
|
const paddingClass = paddingMap[level];
|
||||||
|
const isActive = index === selectedIndex;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DialogClose key={item.href} asChild>
|
<DialogClose key={item.href} asChild>
|
||||||
<Anchor
|
<Anchor
|
||||||
className={cn(
|
|
||||||
"dark:hover:bg-stone-900 hover:bg-stone-100 w-full px-3 rounded-sm text-sm flex items-center gap-2.5",
|
|
||||||
paddingClass
|
|
||||||
)}
|
|
||||||
href={`/docs${item.href}`}
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
className={cn(
|
className={cn(
|
||||||
"flex items-center w-fit h-full py-3 gap-1.5 px-2",
|
"dark:hover:bg-accent/15 hover:bg-accent/10 w-full px-3 rounded-sm text-sm flex items-center gap-2.5",
|
||||||
level > 1 && "border-l pl-4"
|
isActive && "bg-primary/20 dark:bg-primary/30",
|
||||||
|
paddingClass
|
||||||
)}
|
)}
|
||||||
>
|
href={`/docs${item.href}`}
|
||||||
<FileIcon className="h-[1.1rem] w-[1.1rem] mr-1" />{" "}
|
tabIndex={0}
|
||||||
{item.title}
|
>
|
||||||
</div>
|
<div
|
||||||
</Anchor>
|
className={cn(
|
||||||
</DialogClose>
|
"flex items-center w-fit h-full py-3 gap-1.5 px-2",
|
||||||
|
level > 1 && "border-l pl-4"
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
<FileTextIcon className="h-[1.1rem] w-[1.1rem] mr-1" /> {item.title}
|
||||||
|
</div>
|
||||||
|
</Anchor>
|
||||||
|
</DialogClose>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
</ScrollArea>
|
</ScrollArea>
|
||||||
<DialogFooter className="md:flex md:justify-start hidden h-14 px-6 bg-transparent border-t text-[14px] outline-none">
|
<DialogFooter className="md:flex md:justify-start hidden h-14 px-6 bg-transparent border-t text-[14px] outline-none">
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<span className="dark:bg-accent/15 bg-slate-200 border rounded p-2">
|
<span className="dark:bg-accent/15 bg-slate-200 border rounded p-2">
|
||||||
<ArrowUpIcon className="w-3 h-3"/>
|
<ArrowUpIcon className="w-3 h-3"/>
|
||||||
</span>
|
</span>
|
||||||
<span className="dark:bg-accent/15 bg-slate-200 border rounded p-2">
|
<span className="dark:bg-accent/15 bg-slate-200 border rounded p-2">
|
||||||
<ArrowDownIcon className="w-3 h-3"/>
|
<ArrowDownIcon className="w-3 h-3"/>
|
||||||
</span>
|
</span>
|
||||||
<p className="text-muted-foreground">to navigate</p>
|
<p className="text-muted-foreground">to navigate</p>
|
||||||
<span className="dark:bg-accent/15 bg-slate-200 border rounded p-2">
|
<span className="dark:bg-accent/15 bg-slate-200 border rounded p-2">
|
||||||
<CornerDownLeftIcon className="w-3 h-3"/>
|
<CornerDownLeftIcon className="w-3 h-3"/>
|
||||||
</span>
|
</span>
|
||||||
<p className="text-muted-foreground">to select</p>
|
<p className="text-muted-foreground">to select</p>
|
||||||
<span className="dark:bg-accent/15 bg-slate-200 border rounded px-2 py-1">
|
<span className="dark:bg-accent/15 bg-slate-200 border rounded px-2 py-1">
|
||||||
esc
|
esc
|
||||||
</span>
|
</span>
|
||||||
<p className="text-muted-foreground">to close</p>
|
<p className="text-muted-foreground">to close</p>
|
||||||
</div>
|
</div>
|
||||||
</DialogFooter>
|
</DialogFooter>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
@@ -140,5 +179,4 @@ const paddingMap = {
|
|||||||
1: "pl-2",
|
1: "pl-2",
|
||||||
2: "pl-4",
|
2: "pl-4",
|
||||||
3: "pl-10",
|
3: "pl-10",
|
||||||
// Add more levels if needed
|
|
||||||
} as const;
|
} as const;
|
||||||
|
|||||||
@@ -10,24 +10,20 @@ Selamat datang di **AddonSejoliPro** penyedia produk Add-On plugin Sejoli yang s
|
|||||||
|
|
||||||
> Beberapa plugin yang sering digunakan oleh pengguna untuk membuat tampilan custom member area, custom halaman checkout hanya dengan Elementor Page Builder.
|
> Beberapa plugin yang sering digunakan oleh pengguna untuk membuat tampilan custom member area, custom halaman checkout hanya dengan Elementor Page Builder.
|
||||||
|
|
||||||
<div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
<CardGroup cols={2}>
|
||||||
<Card>
|
<Card title="Sejoli Member Area UI" icon="LayoutPanelLeft">
|
||||||
<Card.Title title="Sejoli Member Area UI" icon="LayoutPanelLeft" />
|
Untuk mengubah desain tampilan member area hanya drag and drop.
|
||||||
<Card.Description description="Untuk mengubah desain tampilan member area hanya drag and drop." />
|
</Card>
|
||||||
</Card>
|
<Card title="Sejoli Shortcodes" icon="Brackets">
|
||||||
<Card>
|
Plugin ini merupakan depedensi dari Member Area UI.
|
||||||
<Card.Title title="Sejoli Shortcodes" icon="Brackets" />
|
</Card>
|
||||||
<Card.Description description="Plugin ini merupakan depedensi dari Member Area UI." />
|
<Card title="Sejoli Checkout UI" icon="ReceiptText">
|
||||||
</Card>
|
Mengubah halaman checkout sepenuhnya dengan widget Elementor.
|
||||||
<Card>
|
</Card>
|
||||||
<Card.Title title="Sejoli Checkout UI" icon="ReceiptText" />
|
<Card title="Sejoli LMS Pro" icon="GraduationCap">
|
||||||
<Card.Description description="Mengubah halaman checkout sepenuhnya dengan widget Elementor." />
|
Plugin yang digunakan untuk membuat kursus online based on Sejoli.
|
||||||
</Card>
|
</Card>
|
||||||
<Card>
|
</CardGroup>
|
||||||
<Card.Title title="Sejoli LMS Pro" icon="GraduationCap" />
|
|
||||||
<Card.Description description="Plugin yang digunakan untuk membuat kursus online based on Sejoli." />
|
|
||||||
</Card>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
## Depedensi
|
## Depedensi
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import Tooltip from "@/components/markdown/tooltips";
|
|||||||
import Card from "@/components/markdown/card";
|
import Card from "@/components/markdown/card";
|
||||||
import Button from "@/components/markdown/button";
|
import Button from "@/components/markdown/button";
|
||||||
import Accordion from "@/components/markdown/accordion";
|
import Accordion from "@/components/markdown/accordion";
|
||||||
|
import CardGroup from "@/components/markdown/cardgroup";
|
||||||
|
|
||||||
// add custom components
|
// add custom components
|
||||||
const components = {
|
const components = {
|
||||||
@@ -42,6 +43,7 @@ const components = {
|
|||||||
Card,
|
Card,
|
||||||
Button,
|
Button,
|
||||||
Accordion,
|
Accordion,
|
||||||
|
CardGroup,
|
||||||
};
|
};
|
||||||
|
|
||||||
// can be used for other pages like blogs, Guides etc
|
// can be used for other pages like blogs, Guides etc
|
||||||
|
|||||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "docubook",
|
"name": "docubook",
|
||||||
"version": "1.5.0",
|
"version": "1.7.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "docubook",
|
"name": "docubook",
|
||||||
"version": "1.5.0",
|
"version": "1.7.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@radix-ui/react-accordion": "^1.2.0",
|
"@radix-ui/react-accordion": "^1.2.0",
|
||||||
"@radix-ui/react-avatar": "^1.1.0",
|
"@radix-ui/react-avatar": "^1.1.0",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "docubook",
|
"name": "docubook",
|
||||||
"version": "1.5.0",
|
"version": "1.7.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev",
|
"dev": "next dev",
|
||||||
@@ -51,5 +51,6 @@
|
|||||||
"postcss": "^8",
|
"postcss": "^8",
|
||||||
"tailwindcss": "^3.4.10",
|
"tailwindcss": "^3.4.10",
|
||||||
"typescript": "^5"
|
"typescript": "^5"
|
||||||
}
|
},
|
||||||
|
"packageManager": "pnpm@10.4.1+sha512.c753b6c3ad7afa13af388fa6d808035a008e30ea9993f58c6663e2bc5ff21679aa834db094987129aa4d488b86df57f7b634981b2f827cdcacc698cc0cfb88af"
|
||||||
}
|
}
|
||||||
|
|||||||
504
pnpm-lock.yaml
generated
504
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user