Skip to content

Commit 00eadd5

Browse files
authored
book/super-example: remove CLI tab (#6378)
1 parent 4ee5461 commit 00eadd5

File tree

3 files changed

+18
-218
lines changed

3 files changed

+18
-218
lines changed

book/super-example/aria-tabs.js

Lines changed: 0 additions & 96 deletions
This file was deleted.

book/super-example/super-example.css

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -8,69 +8,6 @@
88
--space-2xs: clamp(0.5625rem, 0.5362rem + 0.1316vi, 0.625rem);
99
--space-s: clamp(1.125rem, 1.0724rem + 0.2632vi, 1.25rem);
1010

11-
& [role='tablist'] {
12-
line-height: 1;
13-
font-size: var(--label-size);
14-
color: var(--color-text-meta);
15-
display: flex;
16-
justify-content: flex-end;
17-
gap: 2px;
18-
margin-bottom: 2px;
19-
}
20-
21-
& [role='tab'] {
22-
border: none;
23-
color: var(--color-text-meta);
24-
padding-block: var(--space-2xs);
25-
background: var(--color-bg-code);
26-
padding-inline: var(--space-s);
27-
cursor: pointer;
28-
font-weight: normal;
29-
user-select: none;
30-
31-
&[aria-selected='true'] {
32-
color: var(--color-text);
33-
}
34-
35-
&:hover:not([aria-selected='true']) {
36-
color: var(--sidebar-active);
37-
}
38-
39-
&:first-child {
40-
border-top-left-radius: calc(var(--radius) / 2);
41-
}
42-
43-
&:last-child {
44-
border-top-right-radius: calc(var(--radius) / 2);
45-
}
46-
}
47-
48-
& [role='tabpanel'],
49-
& [role='tabpanel'] pre {
50-
border-top-right-radius: 0 !important;
51-
}
52-
53-
[hidden=true],[hidden]:not([hidden=false]) {
54-
display: none!important
55-
}
56-
}
57-
58-
.super-command {
59-
border-radius: var(--radius);
60-
background-color: var(--color-bg-code);
61-
color: var(--color-text-code);
62-
63-
& code {
64-
overflow: auto;
65-
}
66-
67-
& pre {
68-
margin-block-start: 0;
69-
margin-block-end: 0;
70-
}
71-
}
72-
73-
.super-playground {
7411
display: grid;
7512
grid-template-rows: auto auto;
7613
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
Lines changed: 18 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { AriaTabs } from './aria-tabs';
21
import { SuperPlayground } from './super-playground';
32

43
const preNodes = document.querySelectorAll('pre:has(> code.language-mdtest-spq)');
@@ -25,49 +24,19 @@ for (const [i, pre] of preNodes.entries()) {
2524
}
2625

2726
const html = `
28-
<article class="super-example">
29-
<nav role="tablist">
30-
<button
31-
role="tab"
32-
aria-selected="true"
33-
aria-controls="playground-panel-${i}"
34-
id="playground-tab-${i}"
35-
tabindex="0"
36-
>
37-
Interactive
38-
</button>
39-
<button
40-
role="tab"
41-
aria-selected="false"
42-
aria-controls="command-panel-${i}"
43-
id="command-tab-${i}"
44-
tabindex="-1"
45-
>
46-
CLI
47-
</button>
48-
</nav>
49-
<section
50-
role="tabpanel"
51-
id="playground-panel-${i}"
52-
class="super-playground"
53-
${attributes}
54-
>
55-
<div class="editor query">
56-
<header class="repel"><label>Query</label></header>
57-
<pre><code></code></pre>
58-
</div>
59-
<div class="editor input">
60-
<header class="repel"><label>Input</label></header>
61-
<pre><code></code></pre>
62-
</div>
63-
<div class="editor result">
64-
<header class="repel"><label>Result</label></header>
65-
<pre><code></code></pre>
66-
</div>
67-
</section>
68-
<section hidden role="tabpanel" id="command-panel-${i}" class="super-command">
27+
<article class="super-example" ${attributes}>
28+
<div class="editor query">
29+
<header class="repel"><label>Query</label></header>
6930
<pre><code></code></pre>
70-
</section>
31+
</div>
32+
<div class="editor input">
33+
<header class="repel"><label>Input</label></header>
34+
<pre><code></code></pre>
35+
</div>
36+
<div class="editor result">
37+
<header class="repel"><label>Result</label></header>
38+
<pre><code></code></pre>
39+
</div>
7140
</article>
7241
`;
7342

@@ -76,22 +45,12 @@ for (const [i, pre] of preNodes.entries()) {
7645
const node = div.children[0];
7746
pre.replaceWith(node);
7847

79-
const tablist = node.querySelector('[role="tablist"]');
80-
AriaTabs.setup(tablist);
81-
82-
node.querySelector('.super-playground .query code').textContent = spq;
83-
node.querySelector('.super-playground .input code').textContent = input;
84-
node.querySelector('.super-playground .result code').textContent = expected;
48+
node.querySelector('.query code').textContent = spq;
49+
node.querySelector('.input code').textContent = input;
50+
node.querySelector('.result code').textContent = expected;
8551

86-
const commandCode = node.querySelector('.super-command code')
87-
SuperPlayground.setup(node, (query, input) => {
88-
let command = `super -s -c '${query}'`;
89-
if (input.length > 0) {
90-
command = `echo '${input}' \\\n| ${command} -`;
91-
}
92-
commandCode.textContent = command;
93-
});
52+
SuperPlayground.setup(node, null);
9453

95-
// Prevent keydown from bubbling up to book.js listeners.
96-
node.addEventListener('keydown', (e) => e.stopPropagation());
54+
// Prevent keydown from bubbling up to book.js listeners.
55+
node.addEventListener('keydown', (e) => e.stopPropagation());
9756
}

0 commit comments

Comments
 (0)