TypeScript · 503 bytes Raw Blame History
1 import { useState, useCallback } from 'react';
2
3 export const useTerminal = () => {
4 const [command, setCommand] = useState('');
5 const [terminalMinimized, setTerminalMinimized] = useState(true);
6
7 const clearCommand = useCallback(() => {
8 setCommand('');
9 }, []);
10
11 const toggleTerminal = useCallback(() => {
12 setTerminalMinimized(prev => !prev);
13 }, []);
14
15 return {
16 command,
17 setCommand,
18 clearCommand,
19 terminalMinimized,
20 setTerminalMinimized,
21 toggleTerminal,
22 };
23 };