- Apply theme overrides as inline CSS variables - Add diff-specific tokens and color-blind diff palette - Update swatches and diff stats to use new semantic colors
23 lines
768 B
TypeScript
23 lines
768 B
TypeScript
import { memo } from "react";
|
|
|
|
export function hasNonZeroStat(stat: { additions: number; deletions: number }): boolean {
|
|
return stat.additions > 0 || stat.deletions > 0;
|
|
}
|
|
|
|
export const DiffStatLabel = memo(function DiffStatLabel(props: {
|
|
additions: number;
|
|
deletions: number;
|
|
showParentheses?: boolean;
|
|
}) {
|
|
const { additions, deletions, showParentheses = false } = props;
|
|
return (
|
|
<>
|
|
{showParentheses && <span className="text-muted-foreground/70">(</span>}
|
|
<span className="text-diff-addition">+{additions}</span>
|
|
<span className="mx-0.5 text-muted-foreground/70">/</span>
|
|
<span className="text-diff-deletion">-{deletions}</span>
|
|
{showParentheses && <span className="text-muted-foreground/70">)</span>}
|
|
</>
|
|
);
|
|
});
|