Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature - mobile friendliness #33

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
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
94 changes: 0 additions & 94 deletions docs/style.css
Original file line number Diff line number Diff line change
@@ -1,101 +1,7 @@
html, body {
height: 100%;
}
body {
font-family: -apple-system, BlinkMacSystemFont,
"Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell",
"Fira Sans", "Droid Sans", "Helvetica Neue",
sans-serif;
}

.app {
display: flex;
align-items: center;
flex-direction: column;
justify-content: center;
height: 100%;
}

select, button {
margin-right: 10px;
}

.home .logo {
background: url(logo.png);
background-size: 250px;
text-indent: 100%;
white-space: nowrap;
overflow: hidden;
width: 250px;
height: 277px;
}

.page .logo {
background: url(logo.png);
background-size: 150px;
background-position: bottom;
text-indent: 100%;
white-space: nowrap;
overflow: hidden;
width: 150px;
height: 26px;
position: fixed;
left: 20px;
top: 20px;
margin: 0;
}

.blue {
color: #00aeef;
}

.orange {
color: orange;
}

footer {
font-size: 12px;
position: static;
margin-top:30px;
text-align: center;
width: 100%;
}

/* Make the footer sticky for desktop */
/*@media(min-height:520px) {
footer {
font-size: 12px;
position: fixed;
bottom: 10px;
}
}*/

/* Enforce landscape mode for mobile https://css-tricks.com/snippets/css/orientation-lock/ */
/*@media (min-width: 320px) and (max-width: 767px) and (orientation: portrait) {
.page {
transform: rotate(-90deg);
transform-origin: left top;
width: 100vh;
overflow-x: hidden;
position: absolute;
top: 100%;
left: 0;
}
}
*/

@media (min-width: 320px) and (max-width: 767px) {
.instrument {
margin-top: 60px;
}

.page .logo {
background-size: 120px;
width: 120px;
height: 20px;
}

.guitarContainer .fifteenthFret {
display: none !important;
}
}
2 changes: 1 addition & 1 deletion docs/vendor.js.map

Large diffs are not rendered by default.

102 changes: 102 additions & 0 deletions src/App.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
html, body {
}
body {
font-family: -apple-system, BlinkMacSystemFont,
"Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell",
"Fira Sans", "Droid Sans", "Helvetica Neue",
sans-serif;
overflow: hidden;
}

.app {
display: flex;
flex-direction: column;
height: 100%;
}

button {
margin-right: 10px;
}

.title {
min-height: 40px;
outline: 1px solid blue;
width: 100%;
}

.home .logo {
background-size: 250px;
text-indent: 100%;
white-space: nowrap;
overflow: hidden;
width: 250px;
height: 277px;
}

.page .logo {
background-size: 150px;
background-position: bottom;
text-indent: 100%;
white-space: nowrap;
overflow: hidden;
width: 150px;
height: 26px;
left: 20px;
top: 20px;
margin: 0;
}

.blue {
color: #00aeef;
}

.orange {
color: orange;
}

footer {
font-size: 12px;
position: static;
margin-top:30px;
text-align: center;
width: 100%;
}

/* Make the footer sticky for desktop */
/*@media(min-height:520px) {
footer {
font-size: 12px;
position: fixed;
bottom: 10px;
}
}*/

/* Enforce landscape mode for mobile https://css-tricks.com/snippets/css/orientation-lock/ */
/*@media (min-width: 320px) and (max-width: 767px) and (orientation: portrait) {
.page {
transform: rotate(-90deg);
transform-origin: left top;
width: 100vh;
overflow-x: hidden;
position: absolute;
top: 100%;
left: 0;
}
}
*/

@media (min-width: 320px) and (max-width: 767px) {
.instrument {
margin-top: 60px;
}

.page .logo {
background-size: 120px;
width: 120px;
height: 20px;
}

.guitarContainer .fifteenthFret {
display: none !important;
}
}
18 changes: 13 additions & 5 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import React from 'react';
import { Route, Link } from 'react-router-dom';
import Loadable from "react-loadable";
import Menu from './components/Menu/index';

import './App.less'
import NotesSetter from './components/NotesSetter/index';
export const LoadablePiano = Loadable({
loader: () => import(/* webpackChunkName: "piano" */ './modules/Piano'),
loading: () => <div>loading ...</div>
Expand All @@ -28,10 +29,17 @@ const App = () => {
mainClass += ' app';
return (
<section className={mainClass}>
<Link to="/">
<h1 className="logo">Johann</h1>
</Link>
<Menu />
<nav id="navbar" className="navbar has-shadow is-spaced">
<div className="navbar-brand">
<Link to="/">
<h1 className="logo">Johann</h1>
</Link>
</div>
<div className="navbar-menu">
<Menu />
</div>
</nav>
<NotesSetter />
<Route path='/piano' exact={true} component={LoadablePiano} />
<Route path='/guitar' exact={true} component={LoadableGuitar} />
<Route path='/keyboard' exact={true} component={LoadableComputerKeyboard} />
Expand Down
5 changes: 5 additions & 0 deletions src/components/Dropdown/Dropdown.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.dropdown {
width: 100%;
height: 40px;
border-radius: 4px;
}
4 changes: 2 additions & 2 deletions src/components/Dropdown/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { connect } from 'react-redux';

import './Dropdown.less'
/**
* @param {Array} data A list of (object) items that have the name and value of the option to be displayed
* @param {Function} onChangeEventHandler A function that will be triggered for the onChange event of the dropdown
Expand All @@ -19,7 +19,7 @@ const Dropdown = ({data, onChangeEventHandler, controlType, selectedValue, dispa
onChangeEventHandler(dispatch, dataObj);
};
return (
<select onChange={localOnChangeHandler.bind(this)} data-control-type={controlType} value={selectedValue}>
<select onChange={localOnChangeHandler.bind(this)} data-control-type={controlType} value={selectedValue} className="dropdown">
{list}
</select>
);
Expand Down
23 changes: 0 additions & 23 deletions src/components/Menu/Menu.less
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,6 @@
text-transform: uppercase;
}

nav {
ul {
list-style: none;
margin: 0;
padding: 0;

li {
margin: 0 10px;

a {
color: black;
font-weight: bold;
}
}
}
}
}

.menu, nav ul {
display: flex;
align-items: center;
}

/* The menu on home page is postioned differently than the pages */
Expand All @@ -44,8 +23,6 @@

.page {
.menu {
position: fixed;
top: 20px;
p {
display: none;
}
Expand Down
17 changes: 7 additions & 10 deletions src/components/Menu/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react';
import { Link } from 'react-router-dom';
import NotesSetter from '../NotesSetter/index';
import './Menu.less';

const Menu = () => {
Expand All @@ -11,15 +10,13 @@ const Menu = () => {

return (
<div className="menu">
<p>Generate chord &amp; scale charts to practice</p>
<nav>
<ul>
<li className={guitarSelected}><Link to="/guitar">Guitar</Link></li>
<li className={pianoSelected}><Link to="/piano">Piano</Link></li>
<li className={keyboardSelected}><Link to="/keyboard">Keyboard</Link></li>
</ul>
</nav>
<NotesSetter />
<div className="navbar-start">
<div className="navbar-item">
<div className={guitarSelected}><Link to="/guitar">Guitar</Link></div>
<div className={pianoSelected}><Link to="/piano">Piano</Link></div>
<div className={keyboardSelected}><Link to="/keyboard">Keyboard</Link></div>
</div>
</div>
</div>
);
};
Expand Down
11 changes: 10 additions & 1 deletion src/components/NotesSetter/NotesSetter.less
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
.notesSetter {
list-style: none;
padding: 0;
margin: 5px 0;
display: flex;
width: 100%;
flex-direction: column;

}

.notesSetterkey {
padding: 0;
margin: 0px;
display: flex;
flex-direction: row;
}
26 changes: 13 additions & 13 deletions src/components/NotesSetter/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,25 +34,25 @@ const NotesSetter = ({ currentScale, currentChord, notesType, rootNote }) => {
}

return (
<ul className="notesSetter">
<li>
<Dropdown
data={getPitches()}
controlType="rootNote"
onChangeEventHandler={controlChanged}
selectedValue={rootNote}
/>
</li>
<li>{getChordScaleDropdown()}</li>
<li>
<div className="notesSetter">
<div>
<Dropdown
data={notesTypeOptions}
controlType="notesType"
onChangeEventHandler={controlChanged}
selectedValue={notesType}
/>
</li>
</ul>
</div>
<div className="notesSetterkey">
<Dropdown
data={getPitches()}
controlType="rootNote"
onChangeEventHandler={controlChanged}
selectedValue={rootNote}
/>
{getChordScaleDropdown()}
</div>
</div>
);
};

Expand Down
2 changes: 2 additions & 0 deletions src/modules/ComputerKeyboard/ComputerKeyboard.less
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

.computer-keys {
display: flex;
width: fit-content;
margin: auto;
}

.computer-keys div {
Expand Down
Loading