Skip to content

Commit 73d02e0

Browse files
author
Salma Alam-Naylor
committed
Split out scale degrees info to a separate component
1 parent 24e1b89 commit 73d02e0

12 files changed

+317
-251
lines changed

apps/fretonator-web/src/app/common/fretonator/fretonator.component.html

Lines changed: 2 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -54,79 +54,8 @@
5454
</div>
5555

5656
<div class="infoContainer">
57-
58-
<div class="infoContainer__row">
59-
<div class="degrees" *ngIf="mode | displayScaleDegrees">
60-
<h4 class="degreesDisplay__title">Degrees</h4>
61-
<div class="degreesDisplay">
62-
<span class="degreesDisplay__degree degreesDisplay__degree--tonic">1</span>
63-
<span class="degreesDisplay__degree degreesDisplay__degree--mediant"
64-
>3</span
65-
>
66-
<span class="degreesDisplay__degree degreesDisplay__degree--dominant"
67-
>5</span>
68-
</div>
69-
<button class="scaleDegrees__toggle"
70-
aria-label="Scale Degrees Info Toggle"
71-
aria-controls="scaleDegreesInfo"
72-
role="switch"
73-
type="button"
74-
[attr.aria-checked]="showScaleDegreesInfo"
75-
(click)="toggleScaleDegreesInfo()">{{scaleDegreesToggleText}}
76-
</button>
77-
</div>
78-
79-
<div class="scaleDisplay">
80-
<h4 class="scaleDisplay__title">Scale</h4>
81-
<div class="scaleDisplay__notes">
82-
<ng-container *ngFor="let scaleNote of scale; let i = index">
83-
<h5 class="scaleDisplay__note">
84-
{{ scaleNote }}
85-
<span *ngIf="i < scale.length - 1"> - </span>
86-
</h5>
87-
</ng-container>
88-
</div>
89-
</div>
90-
</div>
91-
92-
<div class="scaleDegreesInfo"
93-
id="scaleDegreesInfo"
94-
*ngIf="showScaleDegreesInfo">
95-
<h2 class="scaleDegreesInfo__title">About Scale Degrees
96-
<button class="scaleDegreesInfo__close"
97-
aria-label="Scale Degrees Info Toggle"
98-
aria-controls="scaleDegreesInfo"
99-
role="switch"
100-
type="button"
101-
(click)="toggleScaleDegreesInfo()">
102-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14 14">
103-
<path fill="#474350" fill-rule="evenodd"
104-
d="M14 1.41L12.59 0 7 5.59 1.41 0 0 1.41 5.59 7 0 12.59 1.41 14 7 8.41 12.59 14 14 12.59 8.41 7z"></path>
105-
</svg>
106-
</button>
107-
</h2>
108-
<p class="scaleDegreesInfo__copy">
109-
Each of the 7 notes of a mode or scale is called a <em>scale degree</em>, and has a specific name.
110-
</p>
111-
<ol class="scaleDegreesInfo__list">
112-
<li class="scaleDegreesInfo__listItem">Tonic</li>
113-
<li class="scaleDegreesInfo__listItem">Supertonic</li>
114-
<li class="scaleDegreesInfo__listItem">Mediant</li>
115-
<li class="scaleDegreesInfo__listItem">Subdominant</li>
116-
<li class="scaleDegreesInfo__listItem">Dominant</li>
117-
<li class="scaleDegreesInfo__listItem">Submediant</li>
118-
<li class="scaleDegreesInfo__listItem">Leading note</li>
119-
</ol>
120-
<p class="scaleDegreesInfo__copy">
121-
Notes 1, 3 and 5 of a scale make up the <em>tonic triad</em>, which is simply a chord of three notes built on
122-
the first note of the scale. This is the the most important chord to learn when jamming as it is the <em>home</em>
123-
chord - meaning it's usually the chord that the jam track starts on and returns to often.
124-
</p>
125-
<p class="scaleDegreesInfo__copy">
126-
Scale degrees 1, 3, and 5 are highlighted on the fretboard to give you a helpful point of reference when learning
127-
the mode.
128-
</p>
129-
</div>
57+
<app-scale-map [mode]="mode"
58+
[scale]="scale"></app-scale-map>
13059

13160
<app-interval-map [intervalMap]="intervalMap"></app-interval-map>
13261

apps/fretonator-web/src/app/common/fretonator/fretonator.component.scss

Lines changed: 0 additions & 161 deletions
Original file line numberDiff line numberDiff line change
@@ -230,109 +230,6 @@
230230
}
231231
}
232232

233-
.infoContainer__row {
234-
display: flex;
235-
justify-content: space-between;
236-
margin-bottom: pxToRem($grid-unit * 4);
237-
flex-direction: column;
238-
239-
@media screen and (min-width: $screen-med) {
240-
flex-direction: row;
241-
margin-bottom: 0;
242-
}
243-
}
244-
245-
.degrees {
246-
margin-left: auto;
247-
margin-right: auto;
248-
order: 1;
249-
display: flex;
250-
justify-content: center;
251-
flex-direction: column;
252-
align-items: center;
253-
margin-bottom: pxToRem($grid-unit * 8);
254-
255-
@media screen and (min-width: $screen-med) {
256-
order: 2;
257-
flex-basis: 50%;
258-
align-items: flex-end;
259-
}
260-
}
261-
262-
.degreesDisplay__title {
263-
@include info_container_title;
264-
}
265-
266-
.degreesDisplay {
267-
display: flex;
268-
flex-direction: row;
269-
justify-content: center;
270-
}
271-
272-
.degreesDisplay__degree {
273-
display: flex;
274-
justify-content: center;
275-
align-items: center;
276-
font-size: pxToRem(16);
277-
height: pxToRem($grid-unit * 4);
278-
width: pxToRem($grid-unit * 4);
279-
border-radius: 50%;
280-
font-weight: var(--font-weight-bold);
281-
font-family: var(--font-family-main);
282-
margin-left: pxToRem($grid-unit);
283-
margin-right: pxToRem($grid-unit);
284-
285-
&:last-child {
286-
margin-right: 0;
287-
}
288-
289-
&:first-child {
290-
margin-left: 0;
291-
}
292-
}
293-
294-
.degreesDisplay__degree--tonic {
295-
background-color: var(--note-bg-tonic);
296-
color: var(--note-color-tonic);
297-
}
298-
299-
.degreesDisplay__degree--mediant {
300-
background-color: var(--note-bg-mediant);
301-
color: var(--note-color-mediant);
302-
}
303-
304-
.degreesDisplay__degree--dominant {
305-
background-color: var(--note-bg-dominant);
306-
color: var(--note-color-dominant);
307-
}
308-
309-
.scaleDisplay {
310-
height: pxToRem($grid-unit * 10);
311-
order: 2;
312-
display: flex;
313-
flex-direction: column;
314-
justify-content: center;
315-
align-items: center;
316-
317-
@media screen and (min-width: $screen-med) {
318-
order: 1;
319-
flex-basis: 50%;
320-
margin-top: 0;
321-
align-items: flex-start;
322-
}
323-
}
324-
325-
.scaleDisplay__title {
326-
@include info_container_title;
327-
}
328-
329-
.scaleDisplay__note {
330-
display: inline;
331-
font-size: pxToRem(20);
332-
font-family: var(--font-family-main);
333-
font-weight: var(--font-weight-bold);
334-
}
335-
336233
.arrowHint {
337234
position: relative;
338235
display: block;
@@ -354,61 +251,3 @@
354251
display: none;
355252
}
356253
}
357-
358-
.scaleDegrees__toggle {
359-
@include chip_button_base();
360-
border-color: var(--grey);
361-
color: var(--grey);
362-
margin-top: pxToRem($grid-unit * 2);
363-
}
364-
365-
.scaleDegreesInfo {
366-
background-color: var(--black);
367-
margin-left: pxToRem($grid-unit * -4);
368-
margin-right: pxToRem($grid-unit * -4);
369-
padding: pxToRem($grid-unit * 4);
370-
margin-bottom: pxToRem($grid-unit * 4);
371-
}
372-
373-
.scaleDegreesInfo__title {
374-
@include font_medium();
375-
color: var(--peach);
376-
padding-bottom: pxToRem($grid-unit * 2);
377-
display: flex;
378-
flex-direction: row;
379-
justify-content: space-between;
380-
align-items: center;
381-
}
382-
383-
.scaleDegreesInfo__close {
384-
border-width: 0;
385-
background-color: transparent;
386-
height: pxToRem(44);
387-
width: pxToRem(44);
388-
display: flex;
389-
justify-content: center;
390-
align-items: center;
391-
cursor: pointer;
392-
393-
svg {
394-
height: 50%;
395-
width: 50%;
396-
}
397-
}
398-
399-
.scaleDegreesInfo__copy {
400-
@include font_bodyCopy();
401-
color: var(--offwhite);
402-
margin-top: pxToRem($grid-unit * 2);
403-
margin-bottom: pxToRem($grid-unit * 2);
404-
}
405-
406-
.scaleDegreesInfo__list {
407-
408-
}
409-
410-
.scaleDegreesInfo__listItem {
411-
@include font_bodyCopy();
412-
color: var(--yellow);
413-
margin-bottom: pxToRem($grid-unit * 1);
414-
}
Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
import { Component, Input, OnInit } from '@angular/core';
22
import { ChordMap, FretMap, Mode, Scale } from '../../util/types';
33

4-
enum ScaleDegreesToggleText {
5-
hidden = 'What is this?',
6-
visible = 'Hide info'
7-
}
8-
94
@Component({
105
selector: 'app-fretonator',
116
templateUrl: './fretonator.component.html',
@@ -18,15 +13,8 @@ export class FretonatorComponent implements OnInit {
1813
@Input() chordMap: ChordMap;
1914
@Input() mode: Mode;
2015
frets = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
21-
showScaleDegreesInfo = false;
22-
scaleDegreesToggleText = ScaleDegreesToggleText.hidden;
2316

2417
constructor() {}
2518

2619
ngOnInit(): void {}
27-
28-
toggleScaleDegreesInfo() {
29-
this.showScaleDegreesInfo = !this.showScaleDegreesInfo;
30-
this.scaleDegreesToggleText = this.showScaleDegreesInfo ? ScaleDegreesToggleText.visible : ScaleDegreesToggleText.hidden;
31-
}
3220
}

apps/fretonator-web/src/app/common/fretonator/fretonator.module.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@ import { NgModule } from '@angular/core';
22
import { CommonModule } from '@angular/common';
33
import { FretonatorComponent } from './fretonator.component';
44
import { GetFretFromFretMapPipe } from './get-fret-from-fret-map.pipe';
5-
import { DisplayScaleDegreesPipe } from './display-scale-degrees.pipe';
65
import { ChordMapModule } from './chord-map/chord-map.module';
76
import { IntervalMapModule } from './interval-map/interval-map.module';
7+
import { ScaleMapModule } from './scale-map/scale-map.module';
88

99
@NgModule({
1010
declarations: [
1111
FretonatorComponent,
1212
GetFretFromFretMapPipe,
13-
DisplayScaleDegreesPipe,
1413
],
1514
imports: [
1615
CommonModule,
1716
ChordMapModule,
18-
IntervalMapModule
17+
IntervalMapModule,
18+
ScaleMapModule
1919
],
2020
exports: [
2121
FretonatorComponent

apps/fretonator-web/src/app/common/fretonator/display-scale-degrees.pipe.ts renamed to apps/fretonator-web/src/app/common/fretonator/scale-map/display-scale-degrees.pipe.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Pipe, PipeTransform } from '@angular/core';
2-
import { Mode } from '../../util/types';
2+
import { Mode } from '../../../util/types';
33

44
@Pipe({
55
name: 'displayScaleDegrees'
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<div class="scaleMap__row">
2+
<div class="scaleMap__degrees" *ngIf="mode | displayScaleDegrees">
3+
<h4 class="scaleMap__title">Degrees</h4>
4+
<div class="degreesDisplay">
5+
<span class="degreesDisplay__degree degreesDisplay__degree--tonic">1</span>
6+
<span class="degreesDisplay__degree degreesDisplay__degree--mediant"
7+
>3</span
8+
>
9+
<span class="degreesDisplay__degree degreesDisplay__degree--dominant"
10+
>5</span>
11+
</div>
12+
<button class="scaleDegrees__toggle"
13+
aria-label="Scale Degrees Info Toggle"
14+
aria-controls="scaleMapInfo"
15+
role="switch"
16+
type="button"
17+
[attr.aria-checked]="showscaleMapInfo"
18+
(click)="togglescaleMapInfo()">{{scaleDegreesToggleText}}
19+
</button>
20+
</div>
21+
22+
<div class="scaleDisplay">
23+
<h4 class="scaleDisplay__title">Scale</h4>
24+
<div class="scaleDisplay__notes">
25+
<ng-container *ngFor="let scaleNote of scale; let i = index">
26+
<h5 class="scaleDisplay__note">
27+
{{ scaleNote }}
28+
<span *ngIf="i < scale.length - 1"> - </span>
29+
</h5>
30+
</ng-container>
31+
</div>
32+
</div>
33+
</div>
34+
35+
<div class="scaleMapInfo"
36+
id="scaleMapInfo"
37+
*ngIf="showscaleMapInfo">
38+
<h2 class="scaleMapInfo__title">About Scale Degrees
39+
<button class="scaleMapInfo__close"
40+
aria-label="Scale Degrees Info Toggle"
41+
aria-controls="scaleMapInfo"
42+
role="switch"
43+
type="button"
44+
(click)="togglescaleMapInfo()">
45+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14 14">
46+
<path fill="#474350" fill-rule="evenodd"
47+
d="M14 1.41L12.59 0 7 5.59 1.41 0 0 1.41 5.59 7 0 12.59 1.41 14 7 8.41 12.59 14 14 12.59 8.41 7z"></path>
48+
</svg>
49+
</button>
50+
</h2>
51+
<p class="scaleMapInfo__copy">
52+
Each of the 7 notes of a mode or scale is called a <em>scale degree</em>, and has a specific name.
53+
</p>
54+
<ol class="scaleMapInfo__list">
55+
<li class="scaleMapInfo__listItem">Tonic</li>
56+
<li class="scaleMapInfo__listItem">Supertonic</li>
57+
<li class="scaleMapInfo__listItem">Mediant</li>
58+
<li class="scaleMapInfo__listItem">Subdominant</li>
59+
<li class="scaleMapInfo__listItem">Dominant</li>
60+
<li class="scaleMapInfo__listItem">Submediant</li>
61+
<li class="scaleMapInfo__listItem">Leading note</li>
62+
</ol>
63+
<p class="scaleMapInfo__copy">
64+
Notes 1, 3 and 5 of a scale make up the <em>tonic triad</em>, which is simply a chord of three notes built on
65+
the first note of the scale. This is the the most important chord to learn when jamming as it is the <em>home</em>
66+
chord - meaning it's usually the chord that the jam track starts on and returns to often.
67+
</p>
68+
<p class="scaleMapInfo__copy">
69+
Scale degrees 1, 3, and 5 are highlighted on the fretboard to give you a helpful point of reference when learning
70+
the mode.
71+
</p>
72+
</div>

0 commit comments

Comments
 (0)