import { h, Component } from 'preact'; import Toolbar from 'preact-material-components/Toolbar'; import cx from 'classnames'; import * as style from './style.scss'; import { bind } from '../../lib/util'; type Props = { 'class'?: string, showHeader?: boolean, onToggleDrawer?(): void, showFab?(): void, loadFile(f: File): void }; type State = {}; export default class Header extends Component { input?: HTMLInputElement; @bind setInputRef(c?: Element) { this.input = c as HTMLInputElement; } @bind upload() { this.input!.click(); } @bind handleFiles() { let files = this.input!.files; if (files && files.length) { this.props.loadFile(files[0]); } } render({ class: c, onToggleDrawer, showHeader = true, showFab }: Props) { return ( file_upload menu ); } }