Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 23 additions & 3 deletions k8s-manifest-builder/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -963,6 +963,7 @@
const active = tab.dataset.sectionTarget === sectionNames[activeSection];
tab.classList.toggle("is-active", active);
tab.setAttribute("aria-selected", String(active));
tab.tabIndex = active ? 0 : -1;
});

byId("previous-section").disabled = activeSection === 0;
Expand All @@ -986,7 +987,9 @@
previousName = "web-app";
outputFormat = "yaml";
document.querySelectorAll(".format-button").forEach((button) => {
button.classList.toggle("is-active", button.dataset.format === "yaml");
const active = button.dataset.format === "yaml";
button.classList.toggle("is-active", active);
button.setAttribute("aria-pressed", String(active));
});
syncKindUI();
showSection(0);
Expand Down Expand Up @@ -1060,17 +1063,34 @@
}
});

document.querySelectorAll(".section-tab").forEach((tab) => {
const sectionTabs = [...document.querySelectorAll(".section-tab")];
sectionTabs.forEach((tab, index) => {
tab.addEventListener("click", () => {
showSection(sectionNames.indexOf(tab.dataset.sectionTarget));
});
tab.addEventListener("keydown", (event) => {
let nextIndex;
if (event.key === "ArrowRight") nextIndex = (index + 1) % sectionTabs.length;
if (event.key === "ArrowLeft") {
nextIndex = (index - 1 + sectionTabs.length) % sectionTabs.length;
}
if (event.key === "Home") nextIndex = 0;
if (event.key === "End") nextIndex = sectionTabs.length - 1;
if (nextIndex === undefined) return;

event.preventDefault();
showSection(nextIndex);
sectionTabs[nextIndex].focus();
});
});

document.querySelectorAll(".format-button").forEach((button) => {
button.addEventListener("click", () => {
outputFormat = button.dataset.format;
document.querySelectorAll(".format-button").forEach((candidate) => {
candidate.classList.toggle("is-active", candidate === button);
const active = candidate === button;
candidate.classList.toggle("is-active", active);
candidate.setAttribute("aria-pressed", String(active));
});
render();
});
Expand Down
103 changes: 92 additions & 11 deletions k8s-manifest-builder/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -173,21 +173,62 @@ <h2>Workload settings</h2>
</fieldset>

<div class="section-nav" role="tablist" aria-label="Configuration sections">
<button type="button" class="section-tab is-active" data-section-target="basics">
<button
id="section-tab-basics"
class="section-tab is-active"
type="button"
role="tab"
aria-controls="section-panel-basics"
aria-selected="true"
data-section-target="basics"
>
Basics
</button>
<button type="button" class="section-tab" data-section-target="container">
<button
id="section-tab-container"
class="section-tab"
type="button"
role="tab"
aria-controls="section-panel-container"
aria-selected="false"
data-section-target="container"
tabindex="-1"
>
Container
</button>
<button type="button" class="section-tab" data-section-target="runtime">
<button
id="section-tab-runtime"
class="section-tab"
type="button"
role="tab"
aria-controls="section-panel-runtime"
aria-selected="false"
data-section-target="runtime"
tabindex="-1"
>
Runtime
</button>
<button type="button" class="section-tab" data-section-target="advanced">
<button
id="section-tab-advanced"
class="section-tab"
type="button"
role="tab"
aria-controls="section-panel-advanced"
aria-selected="false"
data-section-target="advanced"
tabindex="-1"
>
Advanced
</button>
</div>

<div class="form-section is-active" data-section="basics">
<div
id="section-panel-basics"
class="form-section is-active"
role="tabpanel"
aria-labelledby="section-tab-basics"
data-section="basics"
>
<div class="section-intro">
<span class="section-number">01</span>
<div>
Expand Down Expand Up @@ -256,7 +297,14 @@ <h4>Annotations</h4>
</div>
</div>

<div class="form-section" data-section="container" hidden>
<div
id="section-panel-container"
class="form-section"
role="tabpanel"
aria-labelledby="section-tab-container"
data-section="container"
hidden
>
<div class="section-intro">
<span class="section-number">02</span>
<div>
Expand Down Expand Up @@ -352,7 +400,14 @@ <h4>Import environment</h4>
</div>
</div>

<div class="form-section" data-section="runtime" hidden>
<div
id="section-panel-runtime"
class="form-section"
role="tabpanel"
aria-labelledby="section-tab-runtime"
data-section="runtime"
hidden
>
<div class="section-intro">
<span class="section-number">03</span>
<div>
Expand Down Expand Up @@ -561,7 +616,14 @@ <h4>Tolerations</h4>
</div>
</div>

<div class="form-section" data-section="advanced" hidden>
<div
id="section-panel-advanced"
class="form-section"
role="tabpanel"
aria-labelledby="section-tab-advanced"
data-section="advanced"
hidden
>
<div class="section-intro">
<span class="section-number">04</span>
<div>
Expand Down Expand Up @@ -867,15 +929,34 @@ <h4 class="mini-heading divided">Container security context</h4>
<span class="step-label">02 / Export</span>
<h2>Generated manifest</h2>
</div>
<div id="validation-status" class="status-pill"><span></span> Ready</div>
<div
id="validation-status"
class="status-pill"
role="status"
aria-live="polite"
>
<span></span> Ready
</div>
</div>

<div class="output-toolbar">
<div class="format-picker" role="group" aria-label="Output format">
<button class="format-button is-active" type="button" data-format="yaml">
<button
class="format-button is-active"
type="button"
aria-pressed="true"
data-format="yaml"
>
YAML
</button>
<button class="format-button" type="button" data-format="json">JSON</button>
<button
class="format-button"
type="button"
aria-pressed="false"
data-format="json"
>
JSON
</button>
</div>
<span id="line-count" class="line-count">0 lines</span>
</div>
Expand Down
10 changes: 6 additions & 4 deletions k8s-manifest-builder/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
--mint-strong: #c6d8ff;
--navy: #0d2038;
--success: #16805a;
--success-strong: #126b4c;
--success-soft: #e1f3ea;
--red: #b33d4a;
--muted-strong: #53647b;
--shadow: 0 20px 56px rgba(23, 55, 94, 0.1);
}

Expand Down Expand Up @@ -919,7 +921,7 @@ main {
align-items: center;
gap: 7px;
padding: 6px 9px;
color: var(--success);
color: var(--success-strong);
background: var(--success-soft);
border-radius: 999px;
font-size: 10px;
Expand All @@ -929,7 +931,7 @@ main {
.status-pill span {
width: 6px;
height: 6px;
background: var(--success);
background: var(--success-strong);
border-radius: 50%;
}

Expand Down Expand Up @@ -959,7 +961,7 @@ main {
.format-button {
min-width: 58px;
padding: 7px 10px;
color: var(--muted);
color: var(--muted-strong);
background: transparent;
border: 0;
border-radius: 7px;
Expand Down Expand Up @@ -1115,7 +1117,7 @@ main {
}

.author-credit span {
color: var(--muted);
color: var(--muted-strong);
font-size: 9px;
font-weight: 650;
}
Expand Down