File size: 7,880 Bytes
d0a3eca
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
import { Bell, Info, AlertTriangle, XCircle, CheckCircle2, Zap, Settings2 } from 'lucide-react';
import { useState } from 'react';

const categories = [
  { id: 'success', label: 'Success', icon: CheckCircle2, color: 'bg-emerald-500/15 text-emerald-400 border-emerald-500/30 hover:bg-emerald-500/25' },
  { id: 'error', label: 'Error', icon: XCircle, color: 'bg-red-500/15 text-red-400 border-red-500/30 hover:bg-red-500/25' },
  { id: 'warning', label: 'Warning', icon: AlertTriangle, color: 'bg-amber-500/15 text-amber-400 border-amber-500/30 hover:bg-amber-500/25' },
  { id: 'info', label: 'Info', icon: Info, color: 'bg-blue-500/15 text-blue-400 border-blue-500/30 hover:bg-blue-500/25' },
  { id: 'neutral', label: 'Neutral', icon: Bell, color: 'bg-zinc-500/15 text-zinc-400 border-zinc-500/30 hover:bg-zinc-500/25' },
];

const animations = [
  { id: 'slideIn', label: 'Slide In', desc: 'Slides from right with spring' },
  { id: 'slideInLeft', label: 'Slide Left', desc: 'Slides from left with spring' },
  { id: 'slideUp', label: 'Slide Up', desc: 'Slides up from bottom' },
  { id: 'slideDown', label: 'Slide Down', desc: 'Slides down from top' },
  { id: 'fade', label: 'Fade', desc: 'Smooth fade in/out' },
  { id: 'scale', label: 'Scale', desc: 'Scales from small to normal' },
  { id: 'bounce', label: 'Bounce', desc: 'Springy bounce effect' },
  { id: 'elastic', label: 'Elastic', desc: 'Elastic spring with movement' },
  { id: 'flip', label: 'Flip', desc: '3D flip rotation' },
  { id: 'swing', label: 'Swing', desc: 'Rotating swing effect' },
  { id: 'zoomBounce', label: 'Zoom Bounce', desc: 'Dramatic zoom with bounce' },
];

const positions = [
  { id: 'top-left', label: 'Top Left' },
  { id: 'top-center', label: 'Top Center' },
  { id: 'top-right', label: 'Top Right' },
  { id: 'bottom-left', label: 'Bottom Left' },
  { id: 'bottom-center', label: 'Bottom Center' },
  { id: 'bottom-right', label: 'Bottom Right' },
  { id: 'center', label: 'Center' },
];

export default function ControlPanel({ config, onConfigChange, onTrigger, onClearAll }) {
  const [activeTab, setActiveTab] = useState('content');

  const tabs = [
    { id: 'content', label: 'Content' },
    { id: 'animation', label: 'Animation' },
    { id: 'behavior', label: 'Behavior' },
  ];

  return (
    <div className="space-y-6">
      <div className="flex items-center gap-2 mb-4">
        <Settings2 className="h-4 w-4 text-indigo-400" />
        <h2 className="text-sm font-semibold text-white tracking-wide uppercase">Configuration</h2>
      </div>

      <div className="flex gap-1 p-1 rounded-xl bg-zinc-900/60 border border-white/[0.06]">
        {tabs.map((tab) => (
          <button
            key={tab.id}
            onClick={() => setActiveTab(tab.id)}
            className={`flex-1 px-3 py-2 text-xs font-medium rounded-lg transition-all duration-200 ${
              activeTab === tab.id
                ? 'bg-white/[0.07] text-white shadow-sm'
                : 'text-zinc-500 hover:text-zinc-300'
            }`}
          >
            {tab.label}
          </button>
        ))}
      </div>

      {activeTab === 'content' && (
        <div className="space-y-5 animate-in fade-in slide-in-from-top-2 duration-300">
          <div>
            <label className="block text-xs font-medium text-zinc-400 mb-3">Alert Category</label>
            <div className="grid grid-cols-5 gap-2">
              {categories.map((cat) => {
                const Icon = cat.icon;
                return (
                  <button
                    key={cat.id}
                    onClick={() => onConfigChange('category', cat.id)}
                    className={`flex flex-col items-center gap-1.5 rounded-xl border px-2 py-3 transition-all duration-200 ${
                      config.category === cat.id
                        ? `${cat.color} ring-1 ring-offset-1 ring-offset-zinc-950 ring-indigo-400/40`
                        : 'border-white/[0.06] bg-zinc-900/40 text-zinc-500 hover:bg-zinc-800/60 hover:text-zinc-300'
                    }`}
                  >
                    <Icon className="h-4 w-4" />
                    <span className="text-[10px] font-medium">{cat.label}</span>
                  </button>
                );
              })}
            </div>
          </div>

          <div>
            <label className="block text-xs font-medium text-zinc-400 mb-2">Alert Title</label>
            <input
              type="text"
              value={config.title}
              onChange={(e) => onConfigChange('title', e.target.value)}
              className="w-full rounded-xl border border-white/[0.06] bg-zinc-900/60 px-4 py-2.5 text-sm text-white placeholder-zinc-600 outline-none transition-all duration-200 focus:border-indigo-400/30 focus:ring-1 focus:ring-indigo-400/20"
              placeholder="Enter alert title..."
            />
          </div>

          <div>
            <label className="block text-xs font-medium text-zinc-400 mb-2">Alert Message</label>
            <textarea
              value={config.message}
              onChange={(e) => onConfigChange('message', e.target.value)}
              rows={3}
              className="w-full resize-none rounded-xl border border-white/[0.06] bg-zinc-900/60 px-4 py-2.5 text-sm text-white placeholder-zinc-600 outline-none transition-all duration-200 focus:border-indigo-400/30 focus:ring-1 focus:ring-indigo-400/20"
              placeholder="Enter alert message..."
            />
          </div>
        </div>
      )}

      {activeTab === 'animation' && (
        <div className="space-y-5 animate-in fade-in slide-in-from-top-2 duration-300">
          <div>
            <label className="block text-xs font-medium text-zinc-400 mb-3">Animation Style</label>
            <div className="grid grid-cols-2 gap-2">
              {animations.map((anim) => (
                <button
                  key={anim.id}
                  onClick={() => onConfigChange('animation', anim.id)}
                  className={`flex flex-col items-start gap-1 rounded-xl border px-3 py-3 text-left transition-all duration-200 ${
                    config.animation === anim.id
                      ? 'border-indigo-400/30 bg-indigo-400/8 text-white'
                      : 'border-white/[0.06] bg-zinc-900/40 text-zinc-400 hover:bg-zinc-800/60 hover:text-zinc-300'
                  }`}
                >
                  <span className="text-xs font-semibold">{anim.label}</span>
                  <span className="text-[10px] text-zinc-500">{anim.desc}</span>
                </button>
              ))}
            </div>
          </div>

          <div>
            <label className="block text-xs font-medium text-zinc-400 mb-3">Position</label>
            <div className="grid grid-cols-3 gap-2">
              {positions.map((pos) => (
                <button
                  key={pos.id}
                  onClick={() => onConfigChange('position', pos.id)}
                  className={`rounded-xl border px-3 py-2 text-xs font-medium transition-all duration-200 ${
                    config.position === pos.id
                      ? 'border-indigo-400/30 bg-indigo-400/8 text-indigo-300'
                      : 'border-white/[0.06] bg-zinc-900/40 text-zinc-500 hover:bg-zinc-800/60 hover:text-zinc-300'
                  }`}
                >
                  {pos.label}
                </button>
              ))}
            </div>
          </div>
        </div>
      )}

      {activeTab === 'behavior' && (
        <div className="space-y-5 animate-in fade-in slide-in-from-top-2 duration-300">
          <div className="flex items-center justify-between rounded-xl border border-white/[0.06] bg-zinc-900/40 px-4 py-3">
            <div>
              <span className="text-sm font-medium text-white">Auto Close</span>
              <p className="text