Files
MajoorWaldi-ComfyUI-Majoor-…/js/components/sidebar/sections/HeaderSection.js
T
MajoorWaldi dc72be0139 feat: enhance JS testing and linting setup
- Added coverage reporting for Vitest with configuration in vitest.config.mjs
- Updated package.json to include new scripts for JS coverage, linting, and formatting
- Modified run_quality_gate.py to allow skipping ESLint and Prettier checks
- Introduced .prettierrc for consistent code formatting
- Created .prettierignore to exclude specific files and directories from formatting
2026-03-28 14:14:28 +01:00

73 lines
2.1 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { t } from "../../../app/i18n.js";
import { setTooltipHint } from "../../../utils/tooltipShortcuts.js";
export function createSidebarHeader(asset, onClose) {
const header = document.createElement("div");
header.className = "mjr-sidebar-header";
header.style.cssText = `
display: flex;
align-items: center;
justify-content: space-between;
padding: 10px 12px;
border-bottom: 1px solid var(--mjr-border, rgba(255,255,255,0.12));
background: var(--mjr-surface-2, #333);
min-width: 0;
`;
const titleDiv = document.createElement("div");
titleDiv.style.cssText = "flex: 1; min-width: 0;";
const filename = document.createElement("div");
filename.className = "mjr-sidebar-filename";
filename.textContent = asset.filename || "Unknown";
filename.title = asset.filename;
filename.style.cssText = `
margin: 0;
font-size: 14px;
font-weight: 600;
color: var(--content-fg, #fff);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
`;
titleDiv.appendChild(filename);
const closeBtn = document.createElement("button");
closeBtn.className = "mjr-sidebar-close";
closeBtn.type = "button";
closeBtn.textContent = "×";
setTooltipHint(closeBtn, t("tooltip.closeSidebar", "Close sidebar"), "Esc");
closeBtn.style.cssText = `
background: none;
border: none;
color: white;
font-size: 26px;
cursor: pointer;
padding: 0;
width: 28px;
height: 28px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 4px;
transition: background 0.2s;
line-height: 1;
`;
closeBtn.addEventListener("mouseenter", () => {
closeBtn.style.background = "rgba(255,255,255,0.1)";
});
closeBtn.addEventListener("mouseleave", () => {
closeBtn.style.background = "none";
});
closeBtn.addEventListener("click", onClose);
header.appendChild(titleDiv);
header.appendChild(closeBtn);
return header;
}