Complete refactor (#123)

This commit is contained in:
Misode
2020-11-23 14:29:16 +01:00
committed by GitHub
parent 0ad33cd88f
commit 982b4728e7
45 changed files with 1162 additions and 1113 deletions

View File

@@ -0,0 +1,28 @@
import { App } from '../App';
import { View } from '../views/View';
import { Dropdown } from './Dropdown';
import { Octicon } from './Octicon';
import { Toggle } from './Toggle';
import { languages } from '../../config.json'
import { Tracker } from '../Tracker';
export const Header = (view: View, title: string, homeLink = '/', panelToggleVisible = false) => `
<header>
<div class="header-title">
<a data-link href="${homeLink}" class="home-link">${Octicon.three_bars}</a>
<h2>${title}</h2>
</div>
<nav>
${panelToggleVisible ? Toggle(view, [['tree', 'code'], ['source', 'note']], App.mobilePanel) : ''}
<ul>
<li>${Dropdown(view, 'globe', languages.map(l => [l.code, l.name]), App.language, Tracker.setLanguage)}</li>
<li>${Toggle(view, [['dark', 'sun'], ['light', 'moon']], App.theme, Tracker.setTheme)}</li>
<li class="dimmed">
<a href="https://github.com/misode/misode.github.io" target="_blank">
${Octicon.mark_github}
</a>
</li>
</ul>
</nav>
</header>
`