MCPcopy Create free account
hub / github.com/Remocn/remocn / CommandMenuExampleScene

Function CommandMenuExampleScene

components/docs/examples/command-menu-example.tsx:20–55  ·  view source on GitHub ↗
(_p: CommandMenuExampleProps = {})

Source from the content-addressed store, hash-verified

18export type CommandMenuExampleProps = Record<string, never>;
19
20export const CommandMenuExampleScene = (_p: CommandMenuExampleProps = {}) => {
21 const frame = useCurrentFrame();
22
23 // Panel: closed → opened at frame 16, then closed again at frame 108.
24 const panelStyle = useCommandMenuTransition([
25 { at: 16, state: "opened", duration: 16 },
26 { at: 108, state: "closed", duration: 12 },
27 ]);
28
29 // Reveal query characters from TYPE_START onward.
30 const revealed = revealCount(
31 Math.max(0, frame - TYPE_START),
32 FPS,
33 QUERY.length,
34 CPS,
35 );
36
37 // The filtered list shrinks as more characters are revealed. We animate the
38 // first row of the filtered list (which becomes "Settings" once "set" is typed).
39 const itemStyle = useCommandMenuItemTransition([
40 { at: 84, state: "hover", duration: 8 },
41 { at: 92, state: "press", duration: 6 },
42 { at: 100, state: "selected", duration: 8 },
43 ]);
44
45 return (
46 <div style={{ position: "relative", width: "100%", height: "100%" }}>
47 <CommandMenu
48 style={panelStyle}
49 query={QUERY}
50 revealCount={revealed}
51 itemStyles={[itemStyle]}
52 />
53 </div>
54 );
55};
56
57export const commandMenuExampleCode = (
58 _values: Record<string, unknown> = {},

Callers

nothing calls this directly

Calls 3

useCommandMenuTransitionFunction · 0.90
revealCountFunction · 0.90

Tested by

no test coverage detected