Skip to content

Commit e4d2aa4

Browse files
committed
fix: oversized icon handling
Signed-off-by: dankeboy36 <[email protected]>
1 parent 783666e commit e4d2aa4

File tree

2 files changed

+95
-1
lines changed

2 files changed

+95
-1
lines changed
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>VSCode Elements — Oversized Icon</title>
7+
<link
8+
rel="stylesheet"
9+
href="/node_modules/@vscode/codicons/dist/codicon.css"
10+
id="vscode-codicon-stylesheet"
11+
>
12+
<script
13+
type="module"
14+
src="/node_modules/@vscode-elements/webview-playground/dist/index.js"
15+
></script>
16+
<script type="module" src="/dist/main.js"></script>
17+
<style>
18+
main {
19+
max-width: 480px;
20+
}
21+
22+
.frame {
23+
border: 1px solid rgba(255, 255, 255, 0.08);
24+
border-radius: 8px;
25+
padding: 12px;
26+
background: rgba(255, 255, 255, 0.02);
27+
}
28+
29+
.oversized-icon {
30+
width: 32px;
31+
height: 32px;
32+
border-radius: 6px;
33+
background: rgba(0, 122, 204, 0.15);
34+
color: #61dafb;
35+
font-weight: 600;
36+
font-size: 12px;
37+
letter-spacing: 0.03em;
38+
display: inline-flex;
39+
align-items: center;
40+
justify-content: center;
41+
box-sizing: border-box;
42+
}
43+
44+
.oversized-icon.small {
45+
width: 16px;
46+
height: 16px;
47+
font-size: 10px;
48+
border-radius: 4px;
49+
background: var(--vscode-inputValidation-errorBorder, #094771);
50+
color: var(--vscode-list-activeSelectionForeground, #ffffff);
51+
}
52+
53+
.oversized-icon.xxl {
54+
width: 64px;
55+
height: 64px;
56+
font-size: 18px;
57+
background: rgba(255, 87, 51, 0.18);
58+
color: #ffb347;
59+
}
60+
</style>
61+
</head>
62+
63+
<body>
64+
<h1>Oversized Icon</h1>
65+
<p>
66+
This demo renders three tree items with 16×16, 32×32, and 64×64 icons so
67+
you can quickly verify how different sizes behave.
68+
</p>
69+
<main>
70+
<vscode-demo class="frame">
71+
<vscode-tree>
72+
<vscode-tree-item>
73+
<span slot="icon-leaf" class="oversized-icon small">SM</span>
74+
Standard icon (16×16)
75+
</vscode-tree-item>
76+
<vscode-tree-item>
77+
<span slot="icon-leaf" class="oversized-icon">XL</span>
78+
Oversized icon (32x32)
79+
</vscode-tree-item>
80+
<vscode-tree-item>
81+
<span slot="icon-leaf" class="oversized-icon xxl">XXL</span>
82+
Bud Spencer tribute (64x64)
83+
</vscode-tree-item>
84+
</vscode-tree>
85+
</vscode-demo>
86+
</main>
87+
</body>
88+
</html>

src/vscode-tree-item/vscode-tree-item.styles.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ const styles: CSSResultGroup = [
101101
justify-content: center;
102102
margin-right: 3px;
103103
min-height: 22px;
104-
overflow: visible;
104+
overflow: hidden;
105105
}
106106
107107
.icon-container slot {
@@ -110,6 +110,12 @@ const styles: CSSResultGroup = [
110110
111111
.icon-container.has-icon {
112112
min-width: 22px;
113+
max-width: 22px;
114+
max-height: 22px;
115+
}
116+
117+
:host(:is(:--show-actions, :state(show-actions))) .icon-container {
118+
overflow: visible;
113119
}
114120
115121
.children {

0 commit comments

Comments
 (0)