Add app info and instrument controls
This commit is contained in:
1 parent
e23825cdb1
commit
9d8f277971
38 files changed
+4001
-257
No files matched your search
@@ -0,0 +1,84 @@
|
||||
import { useRef } from 'react';
|
||||
import { IonButton, IonIcon, IonPopover } from '@ionic/react';
|
||||
import { ellipsisVertical } from 'ionicons/icons';
|
||||
import { usePopoverDisclosure } from '../hooks/usePopoverDisclosure';
|
||||
import type { AppView } from '../views/viewTypes';
|
||||
|
||||
interface AppHeaderProps {
|
||||
activeView: AppView;
|
||||
onNavigate: (view: AppView) => void;
|
||||
}
|
||||
|
||||
export function AppHeader({ activeView, onNavigate }: AppHeaderProps) {
|
||||
const popoverRef = useRef<HTMLIonPopoverElement>(null);
|
||||
const popover = usePopoverDisclosure();
|
||||
|
||||
function selectView(view: AppView): void {
|
||||
void popoverRef.current?.dismiss();
|
||||
onNavigate(view);
|
||||
}
|
||||
|
||||
return (
|
||||
<header className="app-header">
|
||||
<a
|
||||
className="brand"
|
||||
href="#studio"
|
||||
aria-label="BeatHound home"
|
||||
onClick={(event) => {
|
||||
event.preventDefault();
|
||||
onNavigate('studio');
|
||||
}}
|
||||
>
|
||||
<img
|
||||
className="brand-logo"
|
||||
src="/logo/logo-horizontal-dark-notagline.svg"
|
||||
alt=""
|
||||
/>
|
||||
</a>
|
||||
|
||||
<div className="app-header-actions">
|
||||
<span className="header-tag">Sharpen your sense of rhythm</span>
|
||||
<IonButton
|
||||
id="app-menu-trigger"
|
||||
className="app-menu-trigger"
|
||||
fill="clear"
|
||||
aria-label="Open app menu"
|
||||
aria-haspopup="dialog"
|
||||
aria-expanded={popover.isOpen}
|
||||
>
|
||||
<IonIcon icon={ellipsisVertical} />
|
||||
</IonButton>
|
||||
</div>
|
||||
|
||||
<IonPopover
|
||||
className="app-menu-popover"
|
||||
ref={popoverRef}
|
||||
trigger="app-menu-trigger"
|
||||
triggerAction="click"
|
||||
side="bottom"
|
||||
alignment="end"
|
||||
onDidPresent={popover.onDidPresent}
|
||||
onDidDismiss={popover.onDidDismiss}
|
||||
>
|
||||
<nav className="app-menu-options" aria-label="App navigation">
|
||||
<IonButton
|
||||
className="app-menu-option"
|
||||
fill={activeView === 'studio' ? 'solid' : 'clear'}
|
||||
aria-current={activeView === 'studio' ? 'page' : undefined}
|
||||
onClick={() => selectView('studio')}
|
||||
>
|
||||
Beat studio
|
||||
</IonButton>
|
||||
<IonButton
|
||||
className="app-menu-option"
|
||||
fill={activeView === 'about' ? 'solid' : 'clear'}
|
||||
aria-current={activeView === 'about' ? 'page' : undefined}
|
||||
onClick={() => selectView('about')}
|
||||
>
|
||||
About BeatHound
|
||||
</IonButton>
|
||||
</nav>
|
||||
</IonPopover>
|
||||
</header>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user