akhaliq HF Staff commited on
Commit
f62fce1
·
verified ·
1 Parent(s): f5cd716

Upload components/Header.js with huggingface_hub

Browse files
Files changed (1) hide show
  1. components/Header.js +62 -0
components/Header.js ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { useState } from 'react';
2
+
3
+ export default function Header({ onClearChat, messageCount }) {
4
+ const [showDropdown, setShowDropdown] = useState(false);
5
+
6
+ return (
7
+ <div className="bg-white border-b border-gray-200 px-6 py-4">
8
+ <div className="flex items-center justify-between">
9
+ <div className="flex items-center space-x-3">
10
+ <div className="w-10 h-10 bg-gradient-to-r from-primary-500 to-purple-600 rounded-full flex items-center justify-center">
11
+ <svg className="w-6 h-6 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24">
12
+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z" />
13
+ </svg>
14
+ </div>
15
+ <div>
16
+ <h1 className="text-xl font-bold text-gray-900">AI Chatbot</h1>
17
+ <p className="text-sm text-gray-500">{messageCount} messages</p>
18
+ </div>
19
+ </div>
20
+
21
+ <div className="relative">
22
+ <button
23
+ onClick={() => setShowDropdown(!showDropdown)}
24
+ className="p-2 text-gray-400 hover:text-gray-600 focus:outline-none focus:ring-2 focus:ring-primary-500 rounded-lg"
25
+ >
26
+ <svg className="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
27
+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M12 5v.01M12 12v.01M12 19v.01M12 6a1 1 0 110-2 1 1 0 010 2zm0 7a1 1 0 110-2 1 1 0 010 2zm0 7a1 1 0 110-2 1 1 0 010 2z" />
28
+ </svg>
29
+ </button>
30
+
31
+ {showDropdown && (
32
+ <div className="absolute right-0 mt-2 w-48 bg-white rounded-lg shadow-lg border border-gray-200 z-10">
33
+ <button
34
+ onClick={() => {
35
+ onClearChat();
36
+ setShowDropdown(false);
37
+
38
+ className="w-full text-left px-4 py-2 text-sm text-gray-700 hover:bg-gray-50 rounded-t-lg"
39
+ >
40
+ Clear Chat History
41
+ </button>
42
+ </div>
43
+ )}
44
+ </div>
45
+ </div>
46
+
47
+ <div className="mt-3">
48
+ <a
49
+ href="https://huggingface.co/spaces/akhaliq/anycoder"
50
+ target="_blank"
51
+ rel="noopener noreferrer"
52
+ className="inline-flex items-center text-sm text-primary-600 hover:text-primary-800 transition-colors"
53
+ >
54
+ Built with anycoder
55
+ <svg className="ml-1 w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
56
+ <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" />
57
+ </svg>
58
+ </a>
59
+ </div>
60
+ </div>
61
+ );
62
+ }