Skip to content

ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.

feat(18-1): Create ConfigPanel base component

Juan Denisda6ae4de88c3
diff --git a/frontend/src/components/workflow/ConfigPanel.jsx b/frontend/src/components/workflow/ConfigPanel.jsx
new file mode 100644
index 00000000..01ec3b7d
--- /dev/null
+++ b/frontend/src/components/workflow/ConfigPanel.jsx
@@ -0,0 +1,53 @@
+import React, { useEffect, useCallback } from 'react';
+import { X } from 'lucide-react';
+
+const ConfigPanel = ({
+ isOpen,
+ title,
+ icon: Icon,
+ headerColor = '#6366f1',
+ onClose,
+ children,
+ footer
+}) => {
+ const handleKeyDown = useCallback((e) => {
+ if (e.key === 'Escape' && isOpen) {
+ onClose();
+ }
+ }, [isOpen, onClose]);
+
+ useEffect(() => {
+ document.addEventListener('keydown', handleKeyDown);
+ return () => document.removeEventListener('keydown', handleKeyDown);
+ }, [handleKeyDown]);
+
+ return (
+ <div className={`config-panel ${isOpen ? 'open' : ''}`}>
+ <div className="config-panel-header" style={{ borderColor: headerColor }}>
+ <div className="config-panel-title">
+ {Icon && (
+ <div className="config-panel-icon" style={{ backgroundColor: headerColor }}>
+ <Icon size={18} />
+ </div>
+ )}
+ <h3>{title}</h3>
+ </div>
+ <button className="config-panel-close" onClick={onClose}>
+ <X size={18} />
+ </button>
+ </div>
+
+ <div className="config-panel-body">
+ {children}
+ </div>
+
+ {footer && (
+ <div className="config-panel-footer">
+ {footer}
+ </div>
+ )}
+ </div>
+ );
+};
+
+export default ConfigPanel;