Skip to content

Commit ec4df84

Browse files
committed
sidebar functionality
1 parent 408a7e4 commit ec4df84

4 files changed

Lines changed: 34 additions & 43 deletions

File tree

css/editor.css

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -142,12 +142,12 @@ button:active {
142142
#edit-panel {
143143
display: flex;
144144
flex-direction: column;
145-
gap: 5px;
145+
gap: 15px;
146146
background-color: var(--edit-bg);
147147
max-width: 20vw;
148148
min-width: 250px;
149149
overflow-y: scroll;
150-
padding: 0px 15px;
150+
padding: 10px 15px 20px 15px;
151151
border-right: 1px solid rgba(0, 0, 0, 0.25);
152152
}
153153

@@ -171,14 +171,6 @@ button:active {
171171
border: 1px dashed black;
172172
}
173173

174-
#help-icons {
175-
border: 2px solid red;
176-
}
177-
178-
#layout-icons {
179-
border: 2px solid orange;
180-
}
181-
182174
.input-container {
183175
display: flex;
184176
align-items: center;
@@ -190,22 +182,6 @@ button:active {
190182
width: 50%;
191183
}
192184

193-
#notes-icons {
194-
border: 2px solid yellow;
195-
}
196-
197-
#articulations-icons {
198-
border: 2px solid green;
199-
}
200-
201-
#dynamics-icons {
202-
border: 2px solid cyan;
203-
}
204-
205-
#special-symbols-icons {
206-
border: 2px solid purple;
207-
}
208-
209185
#sheet-wrapper {
210186
flex: 1;
211187
display: flex;

index.html

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,27 +28,27 @@
2828
</div>
2929
<div id="main-section">
3030
<div id="sidebar">
31-
<div class="section">
31+
<div class="section" data-target="help-icons">
3232
<!-- some icon -->
3333
<p>Help</p>
3434
</div>
35-
<div class="section">
35+
<div class="section" data-target="layout-icons">
3636
<!-- some icon -->
3737
<p>Layout</p>
3838
</div>
39-
<div class="section">
39+
<div class="section" data-target="notes-icons">
4040
<!-- some icon -->
4141
<p>Notes</p>
4242
</div>
43-
<div class="section">
43+
<div class="section" data-target="articulations-icons">
4444
<!-- some icon -->
4545
<p>Articulations</p>
4646
</div>
47-
<div class="section">
47+
<div class="section" data-target="dynamics-icons">
4848
<!-- some icon -->
4949
<p>Dynamics</p>
5050
</div>
51-
<div class="section">
51+
<div class="section" data-target="special-symbols-icons">
5252
<!-- some icon -->
5353
<p>Special Symbols</p>
5454
</div>
@@ -129,12 +129,15 @@ <h4 id="notes-header" class="edit-panel-headers">Notes/Symbols</h4>
129129
</div>
130130
<div id="articulations-icons">
131131
<h4 id="articulations-header" class="edit-panel-headers">Articulations</h4>
132+
<p>Lorem, ipsum dolor sit amet consectetur adipisicing elit. Molestiae iste cumque quos ducimus hic incidunt fugit cum dolore dicta, neque sequi, voluptatum quaerat iusto esse. Similique doloribus dolorem saepe nemo!</p>
132133
</div>
133134
<div id="dynamics-icons">
134135
<h4 id="dynamics-header" class="edit-panel-headers">Dynamics</h4>
136+
<p>Lorem, ipsum dolor sit amet consectetur adipisicing elit. Molestiae iste cumque quos ducimus hic incidunt fugit cum dolore dicta, neque sequi, voluptatum quaerat iusto esse. Similique doloribus dolorem saepe nemo!</p>
135137
</div>
136138
<div id="special-symbols-icons">
137139
<h4 id="special-symbols-header" class="edit-panel-headers">Special Symbols</h4>
140+
<p>Lorem, ipsum dolor sit amet consectetur adipisicing elit. Molestiae iste cumque quos ducimus hic incidunt fugit cum dolore dicta, neque sequi, voluptatum quaerat iusto esse. Similique doloribus dolorem saepe nemo!</p>
138141
</div>
139142
</div>
140143
<!-- Sheet Music -->

scripts/editor.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,25 @@
11
// Sidebar resizing (later)
22
// also change sidebar section bg color based on what section you're in (kinda like Scratch)
3+
4+
// Jump to section in editor panel
5+
const sections = document.querySelectorAll(".section");
6+
sections.forEach(section => {
7+
const editPanelContainer = document.getElementById("edit-panel");
8+
section.addEventListener("click", () => {
9+
const targetId = section.dataset.target;
10+
const targetElement = document.getElementById(targetId);
11+
const target = targetElement.getBoundingClientRect().top + editPanelContainer.scrollTop - 90;
12+
editPanelContainer.scrollTo({ top: target, behavior: "smooth" });
13+
});
14+
});
15+
16+
// Input areas change on "enter" b/c it's more logical :)
17+
const blurs = document.querySelectorAll(".blur");
18+
blurs.forEach(input => {
19+
input.addEventListener("keydown", e => {
20+
if (e.key === "Enter") {
21+
e.preventDefault;
22+
input.blur(); // blur means "losing focus" so you just exit out of the input box
23+
}
24+
});
25+
});

scripts/svg.js

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -109,17 +109,6 @@ icons.forEach(icon => {
109109
});
110110
});
111111

112-
// Input areas change on "enter" b/c it's more logical :)
113-
const blurs = document.querySelectorAll(".blur");
114-
blurs.forEach(input => {
115-
input.addEventListener("keydown", e => {
116-
if (e.key === "Enter") {
117-
e.preventDefault;
118-
input.blur(); // blur means "losing focus" so you just exit out of the input box
119-
}
120-
});
121-
});
122-
123112
// Adding/Removing Pages
124113
document.getElementById("add-page-btn").addEventListener("click", addPage);
125114
document.getElementById("remove-page-btn").addEventListener("click", removePage);

0 commit comments

Comments
 (0)