-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TAS-2785] ✨ Add random keyword search feature to homepage #2003
base: develop
Are you sure you want to change the base?
[TAS-2785] ✨ Add random keyword search feature to homepage #2003
Conversation
src/pages/index.vue
Outdated
placeholderText: '', | ||
randomKeywords: [], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can be computed props
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/pages/index.vue
Outdated
getRandomPlaceholder() { | ||
if (this.$i18n.locale === 'zh-Hant') { | ||
const shuffled = [...SEARCH_SUGGESTIONS].sort( | ||
() => Math.random() - 0.5 | ||
); | ||
const randomTerms = shuffled.slice(0, 3); | ||
this.randomKeywords = randomTerms; | ||
return randomTerms.join('、'); | ||
} | ||
return this.$t('gutenberg_search_placeholder'); | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be refactored to a searchMixin?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the two use cases(homepage/ bookstore) are different, refactor it as a mixin would require more modifications. so I think it doesn't need to be made into a mixin.
src/pages/index.vue
Outdated
this.placeholderText = this.randomKeywords?.length | ||
? this.randomKeywords.join('、') | ||
: this.$t('gutenberg_search_placeholder'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this can be computed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No description provided.