(_p: CommandMenuExampleProps = {})
| 18 | export type CommandMenuExampleProps = Record<string, never>; |
| 19 | |
| 20 | export 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 | |
| 57 | export const commandMenuExampleCode = ( |
| 58 | _values: Record<string, unknown> = {}, |
nothing calls this directly
no test coverage detected