Skip to content

Commit

Permalink
Final touches
Browse files Browse the repository at this point in the history
  • Loading branch information
Odisseuss committed Apr 20, 2021
1 parent 2df0b6d commit 010cea1
Show file tree
Hide file tree
Showing 19 changed files with 643 additions and 419 deletions.
10 changes: 10 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"@testing-library/jest-dom": "^5.11.6",
"@testing-library/react": "^11.2.2",
"@testing-library/user-event": "^12.5.0",
"@types/howler": "^2.2.2",
"@types/jest": "^26.0.17",
"@types/node": "^12.19.8",
"@types/react": "^16.14.2",
Expand All @@ -17,6 +18,7 @@
"fast-text-encoding": "^1.0.3",
"framer-motion": "^2.9.5",
"global": "^4.4.0",
"howler": "^2.2.1",
"intro.js": "^3.4.0",
"intro.js-react": "^0.3.0",
"react": "^17.0.1",
Expand Down
Binary file added public/Ding.mp3
Binary file not shown.
1 change: 1 addition & 0 deletions src/assets/icons/eigth_note.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/assets/icons/quarter_note.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions src/assets/icons/sixteenth_note.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
46 changes: 42 additions & 4 deletions src/common/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ import * as React from 'react';
import styled from 'styled-components';
import { ReactComponent as Metronome } from '../../assets/icons/Metronome.svg';
import { ReactComponent as Settings } from '../../assets/icons/settings.svg';
import { ReactComponent as EightNote } from '../../assets/icons/eigth_note.svg';
import { ReactComponent as SixteenthNote } from '../../assets/icons/sixteenth_note.svg';
import { ReactComponent as QuarterNote } from '../../assets/icons/quarter_note.svg';

import { Link, useLocation } from 'react-router-dom';
import useOutsideAlerter from '../../utils/hooks/useOutsideClickAlert';
let HeaderContainer = styled.div`
Expand Down Expand Up @@ -62,6 +66,22 @@ let StyledMetronomeSVG = styled(Metronome)`
let StyledSettingsSvg = styled(Settings)`
transition: all 0.2s;
`;
let StyledQuarterNoteSvg = styled(QuarterNote)`
width: 25px;
height: 25px;
margin-left: 10px;
`;
let StyledEightNoteSvg = styled(EightNote)`
width: 25px;
height: 25px;
margin-left: 10px;
`;
let StyledSixteenthNoteSvg = styled(SixteenthNote)`
width: 25px;
height: 25px;
margin-left: 10px;
`;

export interface HeaderProps {
navigateLocation: string;
menuColor: string;
Expand All @@ -78,6 +98,8 @@ export interface HeaderProps {
toggleChromaticMode?: () => void;
chromaticMode?: () => void;
toggleManualStringSelectionMode?: () => void;
setTutorialEnabled: () => void;
noteType?: number;
}

const Header: React.FunctionComponent<HeaderProps> = ({
Expand All @@ -90,10 +112,19 @@ const Header: React.FunctionComponent<HeaderProps> = ({
toggleChromaticMode,
chromaticMode,
toggleManualStringSelectionMode,
setTutorialEnabled,
noteType,
}) => {
let [showMenu, setShowMenu] = React.useState(false);
let dropDownRef = React.useRef(null);

let noteIcon =
noteType === 0 ? (
<StyledSixteenthNoteSvg />
) : noteType === 1 ? (
<StyledEightNoteSvg />
) : (
<StyledQuarterNoteSvg />
);
let location = useLocation();
React.useEffect(() => {
let colors =
Expand All @@ -119,7 +150,9 @@ const Header: React.FunctionComponent<HeaderProps> = ({
const renderDropdownItems = () => {
return location.pathname === '/' ? (
<>
<DropDownItem>Tutorial</DropDownItem>
<DropDownItem onClick={setTutorialEnabled}>
Tutorial
</DropDownItem>
<DropDownItem
onClick={() => {
if (toggleChromaticMode && chromaticMode) {
Expand All @@ -130,6 +163,7 @@ const Header: React.FunctionComponent<HeaderProps> = ({
Chromatic Mode
</DropDownItem>
<DropDownItem
className='manual-selection'
onClick={() => {
if (toggleManualStringSelectionMode) {
toggleManualStringSelectionMode();
Expand All @@ -141,6 +175,9 @@ const Header: React.FunctionComponent<HeaderProps> = ({
</>
) : (
<>
<DropDownItem onClick={setTutorialEnabled}>
Tutorial
</DropDownItem>
<DropDownItem
onClick={() => {
if (handleStartTapTempo && tapTempoActive != undefined)
Expand All @@ -156,14 +193,14 @@ const Header: React.FunctionComponent<HeaderProps> = ({
if (cycleNoteType) cycleNoteType();
}}
>
Note Type
Note Type {noteIcon}
</DropDownItem>
</>
);
};
useOutsideAlerter(dropDownRef, hideMenu);
return (
<HeaderContainer>
<HeaderContainer className='header-container'>
<Link
to={navigateLocation}
style={{
Expand All @@ -173,6 +210,7 @@ const Header: React.FunctionComponent<HeaderProps> = ({
}}
>
<StyledMetronomeSVG
className='navigator'
fill={navigateLocation === '/' ? '#FFFFFF' : '#969696'}
/>
</Link>
Expand Down
Loading

0 comments on commit 010cea1

Please sign in to comment.