Skip to content

Commit 1961446

Browse files
committed
feat: add color display in code section, hide cta
1 parent 3cb2581 commit 1961446

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

components/Code.vue

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,13 @@ const highlighted = computed(() => {
6464
span.appendChild(prev)
6565
span.appendChild(el)
6666
})
67+
68+
tpl.querySelectorAll('.token.color').forEach((el) => {
69+
const span = document.createElement('span')
70+
span.className = 'token chit'
71+
span.style.backgroundColor = el.textContent || 'transparent'
72+
el.parentNode!.insertBefore(span, el)
73+
})
6774
})
6875
})
6976
@@ -169,8 +176,7 @@ function handleClick(event: MouseEvent) {
169176
}
170177
171178
.tp-code-content {
172-
padding-left: 6px;
173-
padding-bottom: 8px;
179+
padding: 0 8px 8px;
174180
overflow-x: auto;
175181
}
176182
@@ -293,4 +299,16 @@ function handleClick(event: MouseEvent) {
293299
.tp-code-content .token.variable:focus:not(:focus-visible) {
294300
outline: 2px solid transparent;
295301
}
302+
303+
.tp-code-content .token.chit {
304+
width: 12px;
305+
height: 12px;
306+
display: inline-block;
307+
margin-right: 2px;
308+
transform: translateY(-1px);
309+
vertical-align: middle;
310+
border-radius: 2px;
311+
border: 1px solid var(--color-border);
312+
cursor: default;
313+
}
296314
</style>

entrypoints/ui/style.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,3 +183,14 @@ tempad ::-webkit-scrollbar-thumb {
183183
width: 1px;
184184
background-color: var(--color-border);
185185
}
186+
187+
[data-testid="design-toolbelt-wrapper"] [class^="toolbelt_banner--container"],
188+
[data-testid="design-toolbelt-wrapper"]:has([class^="toolbelt_banner--container"])
189+
[class^="design_toolbelt--enabledToolsRow"]
190+
~ *,
191+
[data-testid="design-toolbelt-wrapper"]:has([class^="toolbelt_banner--container"])
192+
[class^="mode_toggle_switch_divider"],
193+
[data-testid="design-toolbelt-wrapper"]:has([class^="toolbelt_banner--container"])
194+
[class^="mode_switcher_toggle--toggleWrapper"] {
195+
display: none !important;
196+
}

0 commit comments

Comments
 (0)