Skip to content

Commit 3f85abb

Browse files
committed
split out sections and add js for content
1 parent bdfadc7 commit 3f85abb

File tree

6 files changed

+72
-29
lines changed

6 files changed

+72
-29
lines changed
File renamed without changes.
File renamed without changes.

assets/javascript/start.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
document.addEventListener('DOMContentLoaded',function() {
2+
document.querySelectorAll(".tab-links a").forEach(link => {
3+
link.addEventListener('click', showContent);
4+
});
5+
});
6+
7+
function showContent(event) {
8+
event.preventDefault();
9+
var tab = event.target.getAttribute('href');
10+
// toggle active class for links
11+
document.querySelector(".tab-links a.active").classList.remove('active');
12+
event.target.classList.add('active');
13+
// toggle active class for content
14+
document.querySelector(".tab-content.active").classList.remove('active');
15+
document.getElementById(tab.substring(1)).classList.add('active');
16+
}

assets/sass/pages/_start.scss

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
.content-block {
88
grid-column: full;
9-
padding: 20px 20px 20px 55px;
9+
padding: 20px 20px 20px 50px;
1010
margin-bottom: 5px;
1111
font-weight: 500;
1212

@@ -19,7 +19,7 @@
1919
grid-column: full;
2020

2121
.banner {
22-
padding: 20px 70px 20px 70px;
22+
padding: 20px 50px 20px 50px;
2323
margin-bottom: 5px;
2424

2525
h3 {
@@ -36,10 +36,11 @@
3636
.tab-block {
3737
display: grid;
3838
grid-template-columns: 20% 80%;
39-
padding: 0 70px 0 70px;
39+
padding: 0 50px 0 50px;
4040

4141
.tab-links {
4242
list-style-type: none;
43+
padding: 0;
4344

4445
a {
4546
font-weight: 600;
@@ -51,11 +52,15 @@
5152
}
5253

5354
.tab-content {
54-
display: grid;
55+
display: none;
5556
grid-template-columns: 20% 80%;
5657
column-gap: 20px;
5758
padding-top: 20px;
5859

60+
&.active {
61+
display: grid;
62+
}
63+
5964
img {
6065
display: block;
6166
max-width: 100%;

start/_installation.html

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<section class="start-section">
2+
<div class="purple banner">
3+
<h3>Installing CircuitPython</h3>
4+
</div>
5+
<div class="tab-block">
6+
<ul class="tab-links">
7+
<li><a href="#choose-a-board" class="active">Choose a board</a></li>
8+
<li><a href="#installation">Installation</a></li>
9+
<li><a href="#blink">Blink</a></li>
10+
</ul>
11+
<div id="choose-a-board" class="tab-content active">
12+
<img src="/assets/images/start/circuit_playground.png" />
13+
<div class="details">
14+
<h4>Choose a board</h4>
15+
<p>
16+
Some of the CircuitPython compatible boards come with CircuitPython
17+
installed. Others are CircuitPython-ready, but need to have it
18+
installed. As well, you may want to update the version of
19+
CircuitPython already installed on your board. The steps are the
20+
same for installing and updating.
21+
</p>
22+
</div>
23+
</div> <!-- end tab-content -->
24+
<div id="installation" class="tab-content">
25+
<img src="/assets/images/start/feather.png" />
26+
<div class="details">
27+
<h4>Installation</h4>
28+
<p>
29+
Installation Content Here.
30+
</p>
31+
</div>
32+
</div> <!-- end tab-content -->
33+
<div id="blink" class="tab-content">
34+
<img src="/assets/images/start/feather.png" />
35+
<div class="details">
36+
<h4>Blink</h4>
37+
<p>
38+
Blink Content Here.
39+
</p>
40+
</div>
41+
</div> <!-- end tab-content -->
42+
</div> <!-- end tab-block -->
43+
</section> <!-- end start-section -->
44+

start/index.html

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -15,30 +15,8 @@ <h2>Getting started with CircuitPython is fill in the blank</h2>
1515
editing code. It's that simple.
1616
</p>
1717
</div>
18-
<section class="start-section">
19-
<div class="purple banner">
20-
<h3>Installing CircuitPython</h3>
21-
</div>
22-
<div class="tab-block">
23-
<ul class="tab-links">
24-
<li><a href="#choose-a-board" class="active">Choose a board</a></li>
25-
<li><a href="#installation">Installation</a></li>
26-
<li><a href="#blink">Blink</a></li>
27-
</ul>
28-
<div class="tab-content">
29-
<img src="/assets/images/start/circuit_playground.png" />
30-
<div class="details" id="choose-a-board">
31-
<h4>Choose a board</h4>
32-
<p>
33-
Some of the CircuitPython compatible boards come with CircuitPython
34-
installed. Others are CircuitPython-ready, but need to have it
35-
installed. As well, you may want to update the version of
36-
CircuitPython already installed on your board. The steps are the
37-
same for installing and updating.
38-
</p>
39-
</div>
40-
</div> <!-- end tab-content -->
41-
</div> <!-- end tab-block -->
42-
</section> <!-- end section -->
18+
{% include_relative _installation.html %}
4319

4420
</div>
21+
22+
<script src="/assets/javascript/start.js"></script>

0 commit comments

Comments
 (0)