(
values: Record<string, unknown> = {},
)
| 55 | }; |
| 56 | |
| 57 | export const commandMenuExampleCode = ( |
| 58 | _values: Record<string, unknown> = {}, |
| 59 | ): string => { |
| 60 | const extraProps = ""; |
| 61 | const optsStr = ""; |
| 62 | |
| 63 | return `import { useCurrentFrame } from "remotion"; |
| 64 | import { revealCount } from "@/lib/remocn-ui"; |
| 65 | import { CommandMenu } from "@/components/remocn/command-menu"; |
| 66 | import { useCommandMenuTransition } from "@/components/remocn/use-command-menu-transition"; |
| 67 | import { useCommandMenuItemTransition } from "@/components/remocn/use-command-menu-item-transition"; |
| 68 | |
| 69 | const QUERY = "settings"; |
| 70 | const TYPE_START = 20; |
| 71 | const FPS = 30; |
| 72 | const CPS = 4; |
| 73 | |
| 74 | export const Scene = () => { |
| 75 | const frame = useCurrentFrame(); |
| 76 | |
| 77 | // Panel zooms in, holds while query is typed and a row is selected, then closes. |
| 78 | const panelStyle = useCommandMenuTransition( |
| 79 | [ |
| 80 | { at: 16, state: "opened", duration: 16 }, |
| 81 | { at: 108, state: "closed", duration: 12 }, |
| 82 | ]${optsStr}, |
| 83 | ); |
| 84 | |
| 85 | // revealCount drives how many characters of QUERY are visible — the component |
| 86 | // filters the list as more characters appear. |
| 87 | const revealed = revealCount( |
| 88 | Math.max(0, frame - TYPE_START), |
| 89 | FPS, |
| 90 | QUERY.length, |
| 91 | CPS, |
| 92 | ); |
| 93 | |
| 94 | // Animate the first row of the filtered list: idle → hover → press → selected. |
| 95 | const itemStyle = useCommandMenuItemTransition( |
| 96 | [ |
| 97 | { at: 84, state: "hover", duration: 8 }, |
| 98 | { at: 92, state: "press", duration: 6 }, |
| 99 | { at: 100, state: "selected", duration: 8 }, |
| 100 | ]${optsStr}, |
| 101 | ); |
| 102 | |
| 103 | return ( |
| 104 | <div style={{ position: "relative", width: "100%", height: "100%" }}> |
| 105 | <CommandMenu${extraProps} |
| 106 | style={panelStyle} |
| 107 | query={QUERY} |
| 108 | revealCount={revealed} |
| 109 | itemStyles={[itemStyle]} |
| 110 | /> |
| 111 | </div> |
| 112 | ); |
| 113 | };`; |
| 114 | }; |
nothing calls this directly
no outgoing calls
no test coverage detected