From 1e95c8d20dea7d25289eba2cd6727c754c9b4754 Mon Sep 17 00:00:00 2001 From: Abhishek Date: Mon, 13 Jan 2025 18:19:08 +0530 Subject: [PATCH] Replaced the Placeholder with 'Find' for smaller screen sizes --- .../kolibri-common/components/SearchBox.vue | 30 +++++++++++++++++-- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/packages/kolibri-common/components/SearchBox.vue b/packages/kolibri-common/components/SearchBox.vue index 0fb522c9914..f5dc8181293 100644 --- a/packages/kolibri-common/components/SearchBox.vue +++ b/packages/kolibri-common/components/SearchBox.vue @@ -25,7 +25,7 @@ class="search-input" :class="$computedClass(searchInputStyle)" dir="auto" - :placeholder="placeholder || coreString('searchLabel')" + :placeholder="computedPlaceholder" >
- import commonCoreStrings from 'kolibri/uiText/commonCoreStrings'; + import commonCoreStrings, { coreString } from 'kolibri/uiText/commonCoreStrings'; + import useKResponsiveWindow from 'kolibri-design-system/lib/composables/useKResponsiveWindow'; export default { name: 'SearchBox', mixins: [commonCoreStrings], + setup() { + const { windowBreakpoint } = useKResponsiveWindow(); + return { + windowBreakpoint, + }; + }, props: { icon: { type: String, @@ -117,13 +124,19 @@ textAlign: this.isRtl ? 'right' : '', }; }, + computedPlaceholder() { + if (this.windowBreakpoint <= 3.5) { + return this.$tr('find'); + } + return this.placeholder || coreString('searchLabel'); + }, }, watch: { value(current) { this.searchInputValue = current || ''; }, }, - created() { + created() { this.searchInputValue = this.value; }, methods: { @@ -152,6 +165,9 @@ this.$emit('change', this.searchInputValue); }, }, + $trs: { + find: 'Find', + }, }; @@ -184,8 +200,16 @@ padding: 0; padding-left: 8px; margin: 0; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; vertical-align: middle; border: 0; + @media (max-width: 1260px) { + &::placeholder { + font-size: 12px; + } + } // removes the IE clear button &::-ms-clear {