Skip to content

Commit

Permalink
πŸ”€ Merge #1966 into deploy/rinkeby
Browse files Browse the repository at this point in the history
  • Loading branch information
AuroraHuang22 committed Nov 24, 2024
2 parents 6a04222 + 23ac5df commit 4f0c9a4
Show file tree
Hide file tree
Showing 6 changed files with 206 additions and 128 deletions.
2 changes: 2 additions & 0 deletions src/components/NFTBook/ItemCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@
class="flex flex-col justify-center min-w-0"
>
<NuxtLink
class="group"
:to="
localeLocation({
name: 'store',
Expand All @@ -167,6 +168,7 @@
>
<NFTBookSpecTableLabel :text="$t('identity_type_author')" />
<NFTBookSpecTableValue
class="group-hover:underline"
:text="iscnWorkAuthor"
:preset="preset"
/>
Expand Down
24 changes: 21 additions & 3 deletions src/components/SearchBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@
preset="tertiary"
@click="toggleSearch"
>
<IconSearch />
<div class="flex flex-nowrap items-center gap-[8px]">
<IconSearch />
<p
class="text-medium-gray whitespace-nowrap"
v-text="$t('listing_page_search_label')"
/>
</div>
</ButtonV2>
<div
class="flex items-center justify-center cursor-pointer p-[8px] desktop:hidden"
Expand Down Expand Up @@ -42,10 +48,11 @@
>
<IconSearch />
<input
:value="searchQuery"
ref="searchInput"
class="w-full bg-transparent border-0 focus-visible:outline-none"
type="text"
:placeholder="$t('gutenberg_search_placeholder')"
:value="searchQuery"
:placeholder="placeholderText"
@input="debouncedUpdateSearchKeyword"
/>
<ButtonV2
Expand All @@ -63,6 +70,7 @@

<script>
import debounce from 'lodash.debounce';
import { SEARCH_SUGGESTIONS } from '@/constant/index';
export default {
name: 'SearchBar',
Expand All @@ -75,6 +83,7 @@ export default {
data() {
return {
isSearchOpen: false,
placeholderText: this.$t('gutenberg_search_placeholder'),
};
},
mounted() {
Expand All @@ -88,6 +97,10 @@ export default {
this.$emit('clear');
} else {
this.$emit('open');
this.placeholderText = this.getRandomPlaceholder();
this.$nextTick(() => {
this.$refs.searchInput?.focus();
});
}
this.isSearchOpen = !this.isSearchOpen;
},
Expand All @@ -97,6 +110,11 @@ export default {
},
200
),
getRandomPlaceholder() {
const shuffled = [...SEARCH_SUGGESTIONS].sort(() => Math.random() - 0.5);
const randomTerms = shuffled.slice(0, 3);
return randomTerms.join('、');
},
},
};
</script>
15 changes: 15 additions & 0 deletions src/constant/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -428,3 +428,18 @@ export const SIGN_AUTHORIZATION_PERMISSIONS = [
'read:nftcollection',
'write:nftcollection',
];

export const SEARCH_SUGGESTIONS = [
'免費',
'小θͺͺ',
'ζ—…ιŠ',
'報刊',
'εΏƒιˆ',
'運動',
'θ‘£ε•Ÿη« ',
'ζŽη«‹ε³―',
'ζ–°θž',
'理貑',
'ε€ε‘Šιˆ',
'ηΉͺ本',
];
1 change: 1 addition & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,7 @@
"listing_page_QA_label": "What is the difference between ebooks and paperbacks?",
"listing_page_QA_title": "FAQ",
"listing_page_search": "Search",
"listing_page_search_label": "book title or author",
"listing_page_search_not_found": "Please try different keywords.",
"listing_page_search_recommend": "Or explore our recommended books:",
"listing_page_search_result": "The search results for '{query}':",
Expand Down
1 change: 1 addition & 0 deletions src/locales/zh-Hant.json
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,7 @@
"listing_page_QA_label": "ι›»ε­ζ›Έε’Œη΄™ζœ¬ζ›Έζœ‰δ»€ιΊΌεˆ†εˆ₯?",
"listing_page_QA_title": "εΈΈθ¦‹ε•ι‘Œ",
"listing_page_search": "ζœε°‹",
"listing_page_search_label": "ζœε°‹ζ›Έεζˆ–δ½œθ€…",
"listing_page_search_not_found": "θ«‹ε˜—θ©¦δ½Ώη”¨ε…Άδ»–ι—œι΅ε­—γ€‚",
"listing_page_search_recommend": "ζˆ–ζ˜―ζ‚¨ε―δ»₯η€θ¦½ζˆ‘ε€‘ηš„ζŽ¨θ–¦ζ›Έη±οΌš",
"listing_page_search_result": "δ»₯δΈ‹η‚Ί β€œ{query}” ηš„ζœε°‹η΅ζžœοΌš",
Expand Down
Loading

0 comments on commit 4f0c9a4

Please sign in to comment.