-
Syntax
+
Syntax
{isCopied && (
-
+
Description
diff --git a/apps/playground-web/components/Search/SearchBox.tsx b/apps/playground-web/components/Search/SearchBox.tsx
index 38bc99d..8bd4f6e 100644
--- a/apps/playground-web/components/Search/SearchBox.tsx
+++ b/apps/playground-web/components/Search/SearchBox.tsx
@@ -1,12 +1,13 @@
'use client';
-import { useMemo, useState } from 'react';
+import { useMemo, useRef, useState } from 'react';
import { Search } from 'lucide-react';
import { DiceCmds, DiceCmdMeta } from '@/data/command';
import CommandPage from './CommandPage';
export default function SearchBox() {
const [search, setSearch] = useState('');
+ const scrollRef = useRef(null);
const filteredCommands = useMemo(
() =>
Object.values(DiceCmds).filter((cmd: DiceCmdMeta) =>
@@ -33,7 +34,10 @@ export default function SearchBox() {
/>
-
+
{filteredCommands.map((cmdMeta) => (
))}
+
+
{filteredCommands.length === 0 &&
}
diff --git a/apps/playground-web/context/command.tsx b/apps/playground-web/context/command.tsx
new file mode 100644
index 0000000..9c5d204
--- /dev/null
+++ b/apps/playground-web/context/command.tsx
@@ -0,0 +1,23 @@
+import { createContext, useContext, useState } from 'react';
+
+const CommandContext = createContext<{
+ isOpen: boolean;
+ setIsOpen: (isOpen: boolean) => void;
+}>({
+ isOpen: true,
+ setIsOpen: () => {},
+});
+
+export const useCommandContext = () => useContext(CommandContext);
+
+const CommandProvider = ({ children }: { children: React.ReactNode }) => {
+ const [isOpen, setIsOpen] = useState(false);
+
+ return (
+
+ {children}
+
+ );
+};
+
+export default CommandProvider;
diff --git a/apps/playground-web/styles/globals.css b/apps/playground-web/styles/globals.css
index a6b1fdd..3404ba8 100644
--- a/apps/playground-web/styles/globals.css
+++ b/apps/playground-web/styles/globals.css
@@ -16,3 +16,22 @@ body {
.width-absolute {
width: 100%;
}
+
+.mobile-scrollbar::-webkit-scrollbar {
+ width: 6px;
+}
+
+.mobile-scrollbar::-webkit-scrollbar-track {
+ background: #f1f1f1;
+ cursor: pointer;
+}
+
+.mobile-scrollbar::-webkit-scrollbar-thumb {
+ background: #88888888;
+ border-radius: 10px;
+ width: 5px;
+}
+
+.mobile-scrollbar::-webkit-scrollbar-thumb:hover {
+ background: #555;
+}
\ No newline at end of file
diff --git a/packages/ui/src/button.tsx b/packages/ui/src/button.tsx
index f5a962d..2672a80 100644
--- a/packages/ui/src/button.tsx
+++ b/packages/ui/src/button.tsx
@@ -7,6 +7,7 @@ interface ButtonProps {
className?: string;
variant?: 'default' | 'outline';
'data-testid'?: string;
+ onClick?: () => void;
}
const baseClasses =
@@ -19,6 +20,7 @@ const variantClasses = {
export function Button({
children,
+ onClick,
className = '',
variant = 'default',
...props
@@ -26,6 +28,7 @@ export function Button({
return (