MCPcopy Create free account
hub / github.com/Bitbox-Connect/Bitbox / QuestionForm

Function QuestionForm

client/src/component/DiscussionForum.jsx:142–171  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

140
141 // Function to render the Question Form
142 const QuestionForm = () => {
143 const [newQuestion, setNewQuestion] = useState('');
144
145 const handleSubmit = (e) => {
146 e.preventDefault();
147 if (newQuestion.trim()) {
148 addQuestion(newQuestion);
149 setNewQuestion('');
150 }
151 };
152
153 return (
154 <div className={`p-6 rounded-lg shadow-lg mb-8 ${props.mode === 'dark' ? 'bg-gray-800 text-white' : 'bg-white text-gray-800'}`}>
155 <textarea
156 value={newQuestion}
157 onChange={(e) => setNewQuestion(e.target.value)}
158 placeholder="Ask your question..."
159 className={`w-full p-4 border rounded-md ${props.mode === 'dark' ? 'bg-gray-900 text-white' : 'bg-gray-100 text-gray-800'
160 } focus:outline-none focus:ring-2 ${props.mode === 'dark' ? 'focus:ring-gray-400' : 'focus:ring-gray-500'} transition-all`}
161 />
162 <button
163 onClick={handleSubmit}
164 className={`mt-4 px-6 py-2 rounded-md ${props.mode === 'dark' ? 'bg-gray-600 text-white hover:bg-gray-500' : 'bg-gray-800 text-white hover:bg-gray-600'
165 } focus:outline-none focus:ring-2 ${props.mode === 'dark' ? 'focus:ring-gray-400' : 'focus:ring-gray-500'} transition-colors`}
166 >
167 Ask Question
168 </button>
169 </div>
170 );
171 };
172
173 return (
174 <div className="container mx-auto px-6 py-8 mt-20">

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected