Skip to content

Commit 03fcada

Browse files
author
Ritika Mishra
committed
improved buttons ui
1 parent cd5a468 commit 03fcada

File tree

1 file changed

+21
-12
lines changed

1 file changed

+21
-12
lines changed

src/app/serial-plotter/page.tsx

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ const SerialPlotter = () => {
325325
{viewMode !== "plotter" && (
326326
<div
327327
ref={rawDataRef}
328-
className={`w-full border rounded-xl shadow-lg bg-[#1a1a2e] text-white overflow-auto flex flex-col flex-grow ${viewMode === "both" ? "min-h-[55vh]" : "min-h-[50vh]"}`}
328+
className={`w-full border rounded-xl shadow-lg bg-[#1a1a2e] text-white overflow-auto flex flex-col flex-grow ${viewMode === "both" ? "min-h-[30vh]" : "min-h-[35vh]"}`}
329329
>
330330
{/* Title Bar with Input and Buttons */}
331331
<div className="sticky top-0 flex items-center justify-between bg-[#1a1a2e] p-2 z-10">
@@ -334,39 +334,47 @@ const SerialPlotter = () => {
334334
type="text"
335335
value={command}
336336
onChange={(e) => setCommand(e.target.value)}
337-
placeholder="Enter command (START)"
338-
className="w-full p-2 rounded bg-gray-800 text-white border border-gray-600 text-xs"
337+
placeholder="Enter command"
338+
className="w-full p-2 text-xs font-semibold rounded bg-gray-800 text-white border border-gray-600"
339+
style={{ height: '36px' }} // Ensure the height is consistent with buttons
339340
/>
340341

341342
{/* Buttons (Shifted Left) */}
342343
<div className="flex items-center space-x-2 mr-auto">
343-
<Button onClick={sendCommand} className="px-3 py-1 text-xs font-semibold">Send</Button>
344+
<Button
345+
onClick={sendCommand}
346+
className="px-4 py-2 text-xs font-semibold bg-gray-500 rounded shadow-md hover:bg-gray-500 transition ml-2"
347+
style={{ height: '36px' }} // Set height equal to the input box
348+
>
349+
Send
350+
</Button>
344351
<button
345352
onClick={() => setRawData("")}
346-
className="px-3 py-1 text-xs bg-red-600 text-white rounded shadow-md hover:bg-red-700 transition"
353+
className="px-4 py-2 text-xs bg-red-600 text-white rounded shadow-md hover:bg-red-700 transition"
354+
style={{ height: '36px' }} // Set height equal to the input box
347355
>
348356
Clear
349357
</button>
350358
</div>
351359
</div>
352360

361+
353362
{/* Data Display */}
354-
<pre className="text-xs whitespace-pre-wrap break-words px-4 pb-4 flex-grow overflow-auto">
363+
<pre className="text-xs whitespace-pre-wrap break-words px-4 pb-4 flex-grow overflow-auto rounded-xl">
355364
{rawData}
356365
</pre>
357366
</div>
358367
)}
359-
360368
</div>
369+
361370
{/* Footer Section */}
362-
<footer className="flex flex-col gap-2 sm:flex-row py-2 m-2 w-full shrink-0 items-center justify-center px-2 md:px-4 border-t">
371+
<footer className="flex flex-col gap-2 sm:flex-row py-2 m-2 w-full shrink-0 items-center justify-center px-2 md:px-4">
363372

364373
{/* Connection Button */}
365374
<div className="flex justify-center">
366375
<Button
367376
onClick={isConnected ? disconnectSerial : connectToSerial}
368-
className={`px-4 py-2 text-sm font-semibold transition rounded-xl ${isConnected ? " text-base" : "text-base"
369-
}`}
377+
className={`px-4 py-2 text-sm font-semibold transition rounded-xl ${isConnected ? "text-sm" : "text-sm"}`}
370378
>
371379
{isConnected ? "Disconnect" : "Connect Serial"}
372380
</Button>
@@ -393,18 +401,19 @@ const SerialPlotter = () => {
393401

394402
{/* Baud Rate Selector */}
395403
<div className="flex items-center space-x-2">
396-
<label className="text-xs font-semibold">Baud Rate:</label>
404+
<label className="text-sm font-semibold">Baud Rate:</label>
397405
<select
398406
value={baudRateref.current}
399407
onChange={(e) => handleBaudRateChange(Number(e.target.value))}
400-
className="p-1 border rounded bg-gray-800 text-white text-xs"
408+
className="p-1 border rounded bg-gray-800 text-white text-sm"
401409
>
402410
{[9600, 19200, 38400, 57600, 115200, 230400, 460800, 921600].map((rate) => (
403411
<option key={rate} value={rate}>{rate}</option>
404412
))}
405413
</select>
406414
</div>
407415
</footer>
416+
408417
</div>
409418
);
410419
};

0 commit comments

Comments
 (0)