Refactor Panel and StatusBar components by adding comments for clarity and improving accessibility with aria-labels

This commit is contained in:
ishikabhoyar
2025-03-30 01:59:12 +05:30
parent 697c4b8460
commit 48a14f674d
2 changed files with 24 additions and 8 deletions

View File

@@ -173,7 +173,7 @@ const Panel = ({
))} ))}
<div className="panel-actions"> <div className="panel-actions">
<button className="panel-action-btn"> {/* <button className="panel-action-btn">
<span className="current-terminal">node - frontend</span> <span className="current-terminal">node - frontend</span>
<ChevronDown size={16} /> <ChevronDown size={16} />
</button> </button>
@@ -182,7 +182,7 @@ const Panel = ({
</button> </button>
<button className="panel-action-btn"> <button className="panel-action-btn">
<Maximize2 size={16} /> <Maximize2 size={16} />
</button> </button> */}
<button className="panel-close-btn" onClick={onClose}> <button className="panel-close-btn" onClick={onClose}>
<X size={16} /> <X size={16} />
</button> </button>

View File

@@ -1,10 +1,11 @@
import React from "react"; import React from "react";
"use client"
const StatusBar = ({ togglePanel, panelVisible }) => { const StatusBar = ({ togglePanel, panelVisible }) => {
return ( return (
<div className="status-bar"> <div className="status-bar">
{/* Left Section of the Status Bar */}
<div className="status-bar-left"> <div className="status-bar-left">
{/* Branch Indicator */}
<div className="status-item"> <div className="status-item">
<svg <svg
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
@@ -16,6 +17,7 @@ const StatusBar = ({ togglePanel, panelVisible }) => {
strokeWidth="2" strokeWidth="2"
strokeLinecap="round" strokeLinecap="round"
strokeLinejoin="round" strokeLinejoin="round"
aria-label="Branch Icon"
> >
<line x1="6" y1="3" x2="6" y2="15"></line> <line x1="6" y1="3" x2="6" y2="15"></line>
<circle cx="18" cy="6" r="3"></circle> <circle cx="18" cy="6" r="3"></circle>
@@ -25,6 +27,7 @@ const StatusBar = ({ togglePanel, panelVisible }) => {
<span>main</span> <span>main</span>
</div> </div>
{/* Error Indicator */}
<div className="status-item"> <div className="status-item">
<svg <svg
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
@@ -36,30 +39,41 @@ const StatusBar = ({ togglePanel, panelVisible }) => {
strokeWidth="2" strokeWidth="2"
strokeLinecap="round" strokeLinecap="round"
strokeLinejoin="round" strokeLinejoin="round"
aria-label="Error Icon"
> >
<polyline points="20 6 9 17 4 12"></polyline> <polyline points="20 6 9 17 4 12"></polyline>
</svg> </svg>
<span>0 errors</span> <span>0 errors</span>
</div> </div>
<button className="status-item status-button" onClick={togglePanel}> {/* Toggle Terminal Button */}
<button
className="status-item status-button"
onClick={togglePanel}
aria-label="Toggle Terminal"
>
<span>{panelVisible ? "Hide Terminal" : "Show Terminal"}</span> <span>{panelVisible ? "Hide Terminal" : "Show Terminal"}</span>
</button> </button>
</div> </div>
{/* Right Section of the Status Bar */}
<div className="status-bar-right"> <div className="status-bar-right">
{/* Line and Column Indicator */}
<div className="status-item"> <div className="status-item">
<span>Ln 1, Col 1</span> <span>Ln 1, Col 1</span>
</div> </div>
{/* Spaces Indicator */}
<div className="status-item"> <div className="status-item">
<span>Spaces: 2</span> <span>Spaces: 2</span>
</div> </div>
{/* Encoding Indicator */}
<div className="status-item"> <div className="status-item">
<span>UTF-8</span> <span>UTF-8</span>
</div> </div>
{/* Connection Status */}
<div className="status-item"> <div className="status-item">
<svg <svg
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
@@ -71,6 +85,7 @@ const StatusBar = ({ togglePanel, panelVisible }) => {
strokeWidth="2" strokeWidth="2"
strokeLinecap="round" strokeLinecap="round"
strokeLinejoin="round" strokeLinejoin="round"
aria-label="Connection Icon"
> >
<path d="M5 12.55a11 11 0 0 1 14.08 0"></path> <path d="M5 12.55a11 11 0 0 1 14.08 0"></path>
<path d="M1.42 9a16 16 0 0 1 21.16 0"></path> <path d="M1.42 9a16 16 0 0 1 21.16 0"></path>
@@ -80,6 +95,7 @@ const StatusBar = ({ togglePanel, panelVisible }) => {
<span>Connected</span> <span>Connected</span>
</div> </div>
{/* Bell Icon */}
<div className="status-item"> <div className="status-item">
<svg <svg
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
@@ -91,6 +107,7 @@ const StatusBar = ({ togglePanel, panelVisible }) => {
strokeWidth="2" strokeWidth="2"
strokeLinecap="round" strokeLinecap="round"
strokeLinejoin="round" strokeLinejoin="round"
aria-label="Bell Icon"
> >
<path d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"></path> <path d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"></path>
<path d="M13.73 21a2 2 0 0 1-3.46 0"></path> <path d="M13.73 21a2 2 0 0 1-3.46 0"></path>
@@ -98,8 +115,7 @@ const StatusBar = ({ togglePanel, panelVisible }) => {
</div> </div>
</div> </div>
</div> </div>
) );
} };
export default StatusBar
export default StatusBar;