Skip to content

Commit 2987b26

Browse files
updated search input
1 parent f1bc3e7 commit 2987b26

File tree

4 files changed

+30
-9
lines changed

4 files changed

+30
-9
lines changed

README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,16 @@
1-
# Stackoverflow View
1+
# Stack Overflow View
2+
3+
4+
[![MIT license](https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square)](https://lbesson.mit-license.org/)
5+
[![made-for-VSCode](https://img.shields.io/badge/Made%20for-VSCode-1f425f.svg?logo=visual-studio-code&style=flat-square)](https://code.visualstudio.com/)
6+
[![made-with-svelte](https://img.shields.io/badge/Made%20With-svelte-orange?style=flat-square)](https://github.com/sveltejs/svelte)
7+
8+
Visual Studio Code extension for access to Stack Overflow inside of the editor.
9+
10+
Supports internationalization (Set in configuration)
11+
- English : 🇬🇧 (default)
12+
- Russian : 🇷🇺
13+
- Portuguese : 🇵🇹
14+
- Japanese : 🇯🇵
15+
- Spanish : 🇪🇸
16+

app/src/App.svelte

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,9 @@
5656
}
5757
5858
// Search by selected tag
59-
function handleTagSearch(tag) {
60-
console.log("tag", tag.detail.tag);
61-
62-
if (tag.detail.tag) {
63-
const selectedTag = tag.detail.tag;
59+
function handleTagSearch(event) {
60+
const selectedTag = event.detail.tag;
61+
if (selectedTag) {
6462
const baseUri = "https://api.stackexchange.com/2.2";
6563
const filter = "!Fu4hf8)e-ZPMLisJD6KbEP37j-";
6664
const key = "VP5SbX4dbH8MJUft7hjoaA((";
@@ -88,6 +86,11 @@
8886
}
8987
}
9088
89+
function handleInputSearch(event) {
90+
searchQuery = event.detail.query;
91+
search();
92+
}
93+
9194
// Main search functionality
9295
function search() {
9396
const baseUri = "https://api.stackexchange.com/2.2";
@@ -130,8 +133,9 @@
130133
{:else if section === 'search'}
131134
<Search
132135
on:gotoQuestion={handleGotoQuestion}
133-
on:searchByTag={handleTagSearch}
134136
on:gotoTag={handleGotoTag}
137+
on:searchByTag={handleTagSearch}
138+
on:searchInput={handleInputSearch}
135139
{searchQuery}
136140
{vscode}
137141
{searchData}

app/src/search/Search.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
<SearchTitle {tagData} on:gotoTag />
1717
{#if !tagData}
18-
<SearchInput {searchQuery} />
18+
<SearchInput {searchQuery} on:searchInput />
1919
{/if}
2020
<SearchResultsActions {totalResults} />
2121
{#if isLoading}

app/src/search/SearchInput.svelte

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
<script>
2+
import { createEventDispatcher } from "svelte";
23
export let searchQuery = "";
34
5+
const dispatch = createEventDispatcher();
46
function search(event) {
5-
// TODO: if advanced search tips is open then close it.
7+
dispatch("searchInput", { query: searchQuery });
68
}
79
</script>
810

0 commit comments

Comments
 (0)