Skip to content

Commit

Permalink
Fix: [Client][HeaderBar] アイコンをクリックしても検索できるようにする
Browse files Browse the repository at this point in the history
変換中以外での Enter でも検索できるんだけど、それに気づけない人のためのセーフティーネット的な
  • Loading branch information
tsukumijima committed Aug 26, 2024
1 parent 7f2177f commit 56cc523
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions client/src/components/HeaderBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<div v-if="showSearchInput" class="search-box">
<input class="search-input" type="text" :placeholder="search_placeholder"
v-model="search_query" @keydown="handleKeyDown">
<Icon class="search-input__icon" icon="fluent:search-20-filled" height="24px" />
<Icon class="search-input__icon" icon="fluent:search-20-filled" height="24px" @click="doSearch" />
</div>
<v-btn v-show="isButtonDisplay" variant="flat" class="pwa-install-button"
@click="pwaInstallHandler.install()">
Expand Down Expand Up @@ -59,10 +59,14 @@ const getSearchPath = () => {
const handleKeyDown = (event: KeyboardEvent) => {
if (event.key === 'Enter' && !event.isComposing) {
if (search_query.value.trim()) {
const search_path = getSearchPath();
router.push(`${search_path}?query=${encodeURIComponent(search_query.value.trim())}`);
}
doSearch();
}
};
const doSearch = () => {
if (search_query.value.trim()) {
const search_path = getSearchPath();
router.push(`${search_path}?query=${encodeURIComponent(search_query.value.trim())}`);
}
};
Expand Down Expand Up @@ -174,6 +178,7 @@ const showSearchInput = computed(() => {
padding-left: 4px;
color: rgb(var(--v-theme-text-darken-2));
background: rgb(var(--v-theme-background-lighten-1));
cursor: pointer;
}
}
Expand Down

0 comments on commit 56cc523

Please sign in to comment.