Fix code accordian text alignment

This commit is contained in:
Saoud Rizwan
2024-09-12 12:49:00 -04:00
parent 3a01b44a41
commit b9e2610b38

View File

@@ -49,19 +49,35 @@ const CodeAccordian = ({ code, diff, language, path, isFeedback, isExpanded, onT
msUserSelect: "none", msUserSelect: "none",
}} }}
onClick={onToggleExpand}> onClick={onToggleExpand}>
{isFeedback && <span className="codicon codicon-feedback" style={{ marginRight: "6px" }}></span>} {isFeedback ? (
<span <div style={{ display: "flex", alignItems: "center" }}>
style={{ <span className="codicon codicon-feedback" style={{ marginRight: "6px" }}></span>
whiteSpace: "nowrap", <span
overflow: "hidden", style={{
textOverflow: "ellipsis", whiteSpace: "nowrap",
marginRight: "8px", overflow: "hidden",
// trick to get ellipsis at beginning of string textOverflow: "ellipsis",
direction: "rtl", marginRight: "8px",
textAlign: "left", }}>
}}> User Edits
{isFeedback ? "User Edits" : removeLeadingNonAlphanumeric(path ?? "") + "\u200E"} </span>
</span> </div>
) : (
<>
<span
style={{
whiteSpace: "nowrap",
overflow: "hidden",
textOverflow: "ellipsis",
marginRight: "8px",
// trick to get ellipsis at beginning of string
direction: "rtl",
textAlign: "left",
}}>
{removeLeadingNonAlphanumeric(path ?? "") + "\u200E"}
</span>
</>
)}
<span className={`codicon codicon-chevron-${isExpanded ? "up" : "down"}`}></span> <span className={`codicon codicon-chevron-${isExpanded ? "up" : "down"}`}></span>
</div> </div>
)} )}