Skip to content

Commit d3b5cf4

Browse files
committed
feat: copy button styling improvements
1 parent 94358df commit d3b5cf4

File tree

2 files changed

+63
-36
lines changed

2 files changed

+63
-36
lines changed

src/public/error_info/style.css

Lines changed: 62 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
:root {
2+
--copy-button-bg: var(--slate-3);
3+
--copy-button-active-bg: var(--slate-a4);
4+
--copy-button-border: var(--slate-7);
5+
--copy-button-success-bg: var(--green-5);
6+
--copy-button-success-border: var(--green-7);
7+
--copy-button-success-fg: var(--green-12);
8+
}
9+
html.dark {
10+
--copy-button-bg: var(--slate-3);
11+
--copy-button-active-bg: var(--slate-a4);
12+
--copy-button-border: var(--slate-7);
13+
--copy-button-success-bg: var(--green-3);
14+
--copy-button-success-border: var(--green-4);
15+
--copy-button-success-fg: var(--green-11);
16+
}
17+
118
#error-name {
219
color: var(--danger-fg);
320
font-size: 16px;
@@ -50,65 +67,75 @@
5067
}
5168

5269
#copy-error-btn {
53-
background: transparent;
54-
border: 1px solid var(--border);
55-
border-radius: 6px;
56-
padding: 8px;
57-
cursor: pointer;
5870
display: flex;
5971
align-items: center;
6072
justify-content: center;
6173
margin-left: auto;
62-
color: var(--text-fg);
63-
transition: all 0.2s ease;
64-
opacity: 0.7;
6574
position: relative;
75+
cursor: pointer;
76+
77+
background: transparent;
78+
border: 1px solid var(--copy-button-border);
79+
80+
font-size: 13px;
81+
font-family: inherit;
82+
font-weight: 500;
83+
padding: 4px 8px 6px 8px;
84+
border-radius: var(--radius);
85+
color: var(--title-fg);
86+
transition: all 0.2s ease;
87+
}
88+
89+
#copy-error-btn svg {
90+
width: 18px;
91+
height: 18px;
6692
}
6793

6894
#copy-error-btn:hover {
69-
opacity: 1;
70-
background: var(--bg-hover);
71-
border-color: var(--border-hover);
95+
background: var(--copy-button-active-bg);
7296
}
7397

7498
#copy-error-btn:active {
7599
transform: scale(0.95);
76100
}
77101

78-
#copy-error-btn.copied {
79-
background: var(--success-bg);
80-
color: var(--success-fg);
81-
border-color: var(--success-border);
82-
opacity: 1;
83-
}
84-
85102
#copy-error-btn.copied::after {
86-
content: 'Copied!';
103+
content: 'Copied';
87104
position: absolute;
88-
top: -35px;
105+
top: -30px;
89106
left: 50%;
90107
transform: translateX(-50%);
91-
background: var(--slate-12);
92-
color: var(--slate-1);
93-
padding: 4px 8px;
94-
border-radius: 4px;
95-
font-size: 12px;
108+
background: var(--copy-button-success-bg);
109+
color: var(--copy-button-success-fg);
110+
border: 1px solid var(--copy-button-success-border);
111+
border-radius: 20px;
112+
font-size: 13px;
113+
font-family: inherit;
114+
font-weight: 500;
115+
padding: 2px 8px 4px 8px;
116+
letter-spacing: 0.3px;
96117
white-space: nowrap;
97118
opacity: 0;
98119
animation: copyFeedback 2s ease-in-out forwards;
99120
}
100121

101-
102122
@keyframes copyFeedback {
103-
0% { opacity: 0; transform: translateX(-50%) translateY(5px); }
104-
10% { opacity: 1; transform: translateX(-50%) translateY(0); }
105-
90% { opacity: 1; transform: translateX(-50%) translateY(0); }
106-
100% { opacity: 0; transform: translateX(-50%) translateY(-5px); }
107-
}
108-
109-
#copy-error-btn svg {
110-
width: 16px;
111-
height: 16px;
123+
0% {
124+
opacity: 0;
125+
transform: translateX(-50%) translateY(5px);
126+
}
127+
10% {
128+
opacity: 1;
129+
transform: translateX(-50%) translateY(0);
130+
}
131+
90% {
132+
opacity: 1;
133+
transform: translateX(-50%) translateY(0);
134+
}
135+
100% {
136+
opacity: 0;
137+
transform: translateX(-50%) translateY(-5px);
138+
}
112139
}
113140

114141
@media (min-width: 1024px) {

src/templates/error_info/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const ERROR_ICON_SVG = `<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="tru
1616

1717
const HINT_ICON_SVG = `<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="24" height="24" fill="none"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="m21 2-1 1M3 2l1 1m17 13-1-1M3 16l1-1m5 3h6m-5 3h4M12 3C8 3 5.952 4.95 6 8c.023 1.487.5 2.5 1.5 3.5S9 13 9 15h6c0-2 .5-2.5 1.5-3.5h0c1-1 1.477-2.013 1.5-3.5.048-3.05-2-5-6-5Z"/></svg>`
1818

19-
const COPY_ICON_SVG = `<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="16" height="16" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2m8 0V2a2 2 0 0 0-2-2H10a2 2 0 0 0-2 2v2m8 0H8"/></svg>`
19+
const COPY_ICON_SVG = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M7 7m0 2.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667z" /><path d="M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1" /></svg>`
2020

2121
function htmlAttributeEscape(value: string): string {
2222
return value

0 commit comments

Comments
 (0)