Skip to content

Commit cc29d01

Browse files
Copilotcyanzhong
andauthored
Thinner close button stroke and deduplicate shared resources (#47)
* Initial plan * Make close button stroke width thinner (1.5 → 1.2) Co-authored-by: cyanzhong <6745066+cyanzhong@users.noreply.github.com> * Extract close SVG and system font into shared constants Co-authored-by: cyanzhong <6745066+cyanzhong@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: cyanzhong <6745066+cyanzhong@users.noreply.github.com>
1 parent 78db116 commit cc29d01

3 files changed

Lines changed: 10 additions & 4 deletions

File tree

src/const.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
11
export const repoUrl = 'https://github.com/MarkEdit-app/MarkEdit-proofreading';
2+
3+
export const closeSvg = '<svg width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"><line x1="2" y1="2" x2="10" y2="10"/><line x1="10" y1="2" x2="2" y2="10"/></svg>';
4+
5+
export const systemFont = 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, sans-serif';

src/panel.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import type { ViewUpdate } from '@codemirror/view';
55
import { diagnosticsField, setDiagnosticsEffect } from './decoration';
66
import type { Diagnostic } from './decoration';
77
import { setAccentColor, findDiagnostic, buildCardContent, injectCardCSS } from './card';
8+
import { closeSvg, systemFont } from './const';
89
import { injectStyleSheet } from './styling';
910

1011
const paneWidth = 290;
@@ -171,7 +172,7 @@ function renderPane(dom: HTMLElement, view: EditorView) {
171172

172173
const closeBtn = document.createElement('button');
173174
closeBtn.className = 'harper-pane-close';
174-
closeBtn.innerHTML = '<svg width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><line x1="2" y1="2" x2="10" y2="10"/><line x1="10" y1="2" x2="2" y2="10"/></svg>';
175+
closeBtn.innerHTML = closeSvg;
175176
closeBtn.title = 'Close';
176177
closeBtn.ariaLabel = 'Close';
177178
closeBtn.onclick = () => {
@@ -334,7 +335,7 @@ export function paneCSS(): string {
334335
right: 0;
335336
bottom: 0;
336337
width: ${paneWidth}px;
337-
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, sans-serif;
338+
font-family: ${systemFont};
338339
border-left: 1px solid rgba(0, 0, 0, 0.12);
339340
background: rgba(255, 255, 255, 0.6);
340341
-webkit-backdrop-filter: blur(12px);

src/tooltip.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import type { Tooltip, TooltipView } from '@codemirror/view';
44
import { diagnosticsField } from './decoration';
55
import type { Diagnostic } from './decoration';
66
import { setAccentColor, buildCardContent, ignoreDiagnostic, injectCardCSS } from './card';
7+
import { closeSvg, systemFont } from './const';
78
import { injectStyleSheet } from './styling';
89

910
export const setClickTooltip = StateEffect.define<Diagnostic | null>();
@@ -85,7 +86,7 @@ export const tooltipCSS = `
8586
overflow: hidden;
8687
max-width: 320px;
8788
min-width: 220px;
88-
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, sans-serif;
89+
font-family: ${systemFont};
8990
user-select: none;
9091
-webkit-user-select: none;
9192
-webkit-touch-callout: none;
@@ -159,7 +160,7 @@ function createTooltip(view: EditorView, diagnostic: Diagnostic) {
159160
// Close button at card level (top-right corner)
160161
const close = document.createElement('button');
161162
close.className = 'harper-close';
162-
close.innerHTML = '<svg width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><line x1="2" y1="2" x2="10" y2="10"/><line x1="10" y1="2" x2="2" y2="10"/></svg>';
163+
close.innerHTML = closeSvg;
163164
close.title = 'Close';
164165
close.ariaLabel = 'Close';
165166
close.onmousedown = (e) => e.preventDefault();

0 commit comments

Comments
 (0)