Skip to content

Commit

Permalink
Apply review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
mtruj013 committed Jul 17, 2023
1 parent cf198f2 commit 3098e40
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 15 deletions.
19 changes: 19 additions & 0 deletions static/js/src/risc-v.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Toggles show board based on selection on small screens

const boards = document.querySelectorAll(`[role=tabpanel]`);
const dropdownSelect = document.getElementById("boardSelect");

dropdownSelect.addEventListener("change", (event) => {
selectBoard();
})

function selectBoard() {
boards.forEach(board => {
if (board.id === dropdownSelect.value) {
board.classList.remove("u-hide")
board.focus();
} else {
board.classList.add("u-hide");
}
})
}
16 changes: 2 additions & 14 deletions templates/download/risc-v/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ <h1 class="p-heading--2"><strong>Download Ubuntu for RISC-V Platforms</strong></
<li><button class="p-tabs__item" id="starfive-visionfive-2" role="tab" aria-selected="false" aria-controls="starfive-visionfive-2-tab">StarFive VisionFive 2</button></li>
</ul>
<form class="u-hide--large u-hide--medium">
<select name="boardSelect" id="boardSelect" onchange="selectBoard()">
<select name="boardSelect" id="boardSelect">
<option value="allwinner-nezha-tab" selected="">AllWinner Nezha</option>
<option value="microchip-polarfire-soc-fpga-icicle-kit-tab">Polarfire SoC FPGA Icicle</option>
<option value="qemu-tab">QEMU emulator</option>
Expand Down Expand Up @@ -79,18 +79,6 @@ <h1 class="p-heading--2"><strong>Download Ubuntu for RISC-V Platforms</strong></

<script src="{{ versioned_static('js/dist/tabbedContent.js') }}"></script>

<script>
function selectBoard(){
const selected = document.getElementById("boardSelect").value;
const boards = document.querySelectorAll(`[role=tabpanel]`)
boards.forEach(board => {
if (board.id === selected){
board.classList.remove("u-hide")
} else {
board.classList.add("u-hide")
}
})
}
</script>
<script src="{{ versioned_static('js/src/risc-v.js') }}"></script>

{% endblock content %}
2 changes: 1 addition & 1 deletion templates/download/risc-v/tab-2.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div tabindex="0" role="tabpanel" id="microchip-polarfire-soc-fpga-icicle-kit-tab" aria-labelledby="live-installer" aria-hidden="true">
<div tabindex="0" role="tabpanel" id="microchip-polarfire-soc-fpga-icicle-kit-tab" aria-labelledby="microchip-polarfire-soc-fpga-icicle-kit" aria-hidden="true">
<div class="row p-strip is-shallow u-no-padding--top">
<div class="col-3">
<h2 class="u-hide--small">Microchip Polarfire SoC <br>FPGA Icicle Kit</h2>
Expand Down

0 comments on commit 3098e40

Please sign in to comment.