Skip to content

Commit

Permalink
feat: small refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
kurozenzen committed May 6, 2023
1 parent 5945380 commit 7cb0c3c
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 13 deletions.
26 changes: 26 additions & 0 deletions src/lib/tag-input/HelpButton.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<script>
import currentPage from '../navigation/currentPage'
import onEnterOrSpace from '../common/onEnterOrSpace'
const goToHelp = () => currentPage.navigateTo('help')
</script>

<i
tabindex="0"
role="button"
class="codicon codicon-question spaced"
on:click={goToHelp}
on:keyup={onEnterOrSpace(goToHelp)}
/>

<style>
i {
width: var(--line-height);
height: var(--line-height);
line-height: var(--line-height);
font-size: var(--text-size-large);
vertical-align: middle;
text-align: center;
cursor: pointer;
}
</style>
16 changes: 3 additions & 13 deletions src/lib/tag-input/TagInput.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
import { createEventDispatcher } from 'svelte'
import ModifierSelect from '../modifier/ModifierSelect.svelte'
import LoadingAnimation from '../common/LoadingAnimation.svelte'
import currentPage from '../navigation/currentPage'
import onEnterOrSpace, { isEnter } from '../common/onEnterOrSpace'
import { isEnter } from '../common/onEnterOrSpace'
import { getTagSuggestions } from '../../api-client/ApiClient'
import userdata from '../account/userdata'
import { Tag, toActiveTag } from '../../types/tags/Tag'
import TagSuggestion from './TagSuggestion.svelte'
import HelpButton from './HelpButton.svelte'
/**
* @typedef {import("../../types/tags/Tag").Tag} Tag
Expand Down Expand Up @@ -99,13 +99,7 @@
modifier = e.detail
}}
/>
<i
tabindex="0"
role="button"
class="codicon codicon-question spaced"
on:click={() => currentPage.navigateTo('help')}
on:keyup={onEnterOrSpace(() => currentPage.navigateTo('help'))}
/>
<HelpButton />
<ol class:open>
{#await searchPromise}
<div class="suggestion-footer">
Expand Down Expand Up @@ -183,10 +177,6 @@
min-height: 22px;
}
.codicon-question {
cursor: pointer;
}
.suggestion-footer {
display: flex;
justify-content: center;
Expand Down

0 comments on commit 7cb0c3c

Please sign in to comment.