Skip to content

Commit

Permalink
Replaced the Placeholder with 'Find' for smaller screen sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
Abhishek-Punhani committed Jan 14, 2025
1 parent 66ff3c0 commit 1e95c8d
Showing 1 changed file with 27 additions and 3 deletions.
30 changes: 27 additions & 3 deletions packages/kolibri-common/components/SearchBox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
class="search-input"
:class="$computedClass(searchInputStyle)"
dir="auto"
:placeholder="placeholder || coreString('searchLabel')"
:placeholder="computedPlaceholder"
>
<div class="search-buttons-wrapper">
<KIconButton
Expand Down Expand Up @@ -61,11 +61,18 @@

<script>
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,
Expand Down Expand Up @@ -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: {
Expand Down Expand Up @@ -152,6 +165,9 @@
this.$emit('change', this.searchInputValue);
},
},
$trs: {
find: 'Find',
},
};
</script>
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 1e95c8d

Please sign in to comment.