pinafore/src/routes/_components/ShortcutHelpInfo.html
Nolan Lawson 3d58c86963
feat: left/right keys can change columns or focus (#1516)
* feat: left/right keys can change columns or focus

* fixup

* fixup, add tests
2019-09-22 23:53:29 -07:00

106 lines
3.2 KiB
HTML

<div class="shortcut-help-info {inDialog ? 'in-dialog' : ''}"
tabindex="{inDialog ? '0' : '-1'}"
>
<!-- Svelte makes this file kind of ridiculously large for a static page (~17kB),
so just use raw HTML here to make it smaller -->
{@html `
<h2>Global</h2>
<div class="hotkey-group">
${$leftRightChangesFocus ?
`
<ul>
<li><kbd></kbd> to go to the next focusable element</li>
<li><kbd></kbd> to go to the previous focusable element</li>
</ul>
` : ''}
<ul>
<li>
<kbd>1</kbd> - <kbd>6</kbd>
${$leftRightChangesFocus ? '' : `or <kbd></kbd>/<kbd></kbd>`}
to switch columns
</li>
<li><kbd>7</kbd> or <kbd>c</kbd> to compose a new toot</li>
<li><kbd>s</kbd> to search</li>
<li><kbd>g</kbd> + <kbd>h</kbd> to go home</li>
<li><kbd>g</kbd> + <kbd>n</kbd> to go to notifications</li>
<li><kbd>g</kbd> + <kbd>l</kbd> to go to the local timeline</li>
<li><kbd>g</kbd> + <kbd>t</kbd> to go to the federated timeline</li>
<li><kbd>g</kbd> + <kbd>c</kbd> to go to the community page</li>
<li><kbd>g</kbd> + <kbd>d</kbd> to go to the conversations page</li>
<li><kbd>h</kbd> or <kbd>?</kbd> to toggle the help dialog</li>
<li><kbd>Backspace</kbd> to go back, close dialogs</li>
</ul>
</div>
<h2>Timeline</h2>
<div class="hotkey-group">
<ul>
<li><kbd>j</kbd> or <kbd></kbd> to activate the next toot</li>
<li><kbd>k</kbd> or <kbd></kbd> to activate the previous toot</li>
<li><kbd>.</kbd> to show more and scroll to top</li>
<li><kbd>o</kbd> to open</li>
<li><kbd>f</kbd> to favorite</li>
<li><kbd>b</kbd> to boost</li>
<li><kbd>r</kbd> to reply</li>
<li><kbd>m</kbd> to mention the author</li>
<li><kbd>p</kbd> to open the author's profile</li>
<li><kbd>l</kbd> to open the card's link in a new tab</li>
<li><kbd>x</kbd> to show or hide text behind content warning</li>
<li><kbd>y</kbd> to show or hide sensitive media</li>
</ul>
</div>
<h2>Media</h2>
<div class="hotkey-group">
<ul>
<li><kbd></kbd> / <kbd></kbd> to go to next or previous</li>
</ul>
</div>
`}
</div>
<style>
.shortcut-help-info.in-dialog {
overflow-y: auto;
}
.shortcut-help-info.in-dialog:not(:focus) {
scrollbar-width: none;
-ms-overflow-style: none;
}
.shortcut-help-info.in-dialog:not(:focus)::-webkit-scrollbar {
display: none;
}
:global(.shortcut-help-info li) {
list-style-type: none;
}
:global(.shortcut-help-info.in-dialog li) {
color: var(--muted-modal-text);
font-size: 0.9em;
}
:global(.shortcut-help-info.in-dialog h2) {
color: var(--muted-modal-text);
}
:global(.shortcut-help-info.hotkey-group) {
margin: 0 0 10px 10px;
}
:global(.shortcut-help-info h2) {
margin: 10px 0;
}
:global(.shortcut-help-info kbd) {
color: #333;
display: inline-block;
border: 1px solid #333;
border-radius: 2px;
padding: 0.1em;
margin: 0.2em;
background-color: #dadada;
}
</style>
<script>
import { store } from '../_store/store'
export default {
store: () => store,
data: () => ({
inDialog: false
})
}
</script>