Skip to content

Commit 4e55426

Browse files
fix(website): keep diagnostic count next to rule name on narrow widths (#181)
Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Aiden Bai <aidenybai@users.noreply.github.com>
1 parent cca5808 commit 4e55426

1 file changed

Lines changed: 2 additions & 10 deletions

File tree

packages/website/src/components/terminal.tsx

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ const TOTAL_ISSUE_COUNT = 36;
2525
const TOTAL_SOURCE_FILE_COUNT = 42;
2626
const AFFECTED_FILE_COUNT = 18;
2727
const ELAPSED_TIME = "2.1s";
28-
const RULE_NAME_COLUMN_WIDTH = 42;
2928

3029
const ANIMATION_COMPLETED_KEY = "react-doctor-animation-completed";
3130
const COMMAND = "npx react-doctor@latest";
@@ -96,11 +95,6 @@ const FadeIn = ({ children }: { children: React.ReactNode }) => (
9695
<div className="animate-fade-in">{children}</div>
9796
);
9897

99-
const padRuleName = (ruleName: string): string => {
100-
if (ruleName.length >= RULE_NAME_COLUMN_WIDTH) return ruleName;
101-
return ruleName + "\u00A0".repeat(RULE_NAME_COLUMN_WIDTH - ruleName.length);
102-
};
103-
10498
const ScoreBar = ({ score, barWidth }: { score: number; barWidth: number }) => {
10599
const filledCount = Math.round((score / PERFECT_SCORE) * barWidth);
106100
const emptyCount = barWidth - filledCount;
@@ -168,10 +162,8 @@ const DiagnosticItem = ({ diagnostic }: { diagnostic: RuleDiagnostic }) => {
168162
/>
169163
<span>
170164
<span className={colorClass}>{icon} </span>
171-
<span className={colorClass}>
172-
{countBadge ? padRuleName(diagnostic.ruleKey) : diagnostic.ruleKey}
173-
</span>
174-
{countBadge && <span className="text-neutral-500">{` ${countBadge}`}</span>}
165+
<span className={colorClass}>{diagnostic.ruleKey}</span>
166+
{countBadge && <span className="text-neutral-500">{`\u00A0${countBadge}`}</span>}
175167
</span>
176168
</button>
177169
<div

0 commit comments

Comments
 (0)