Skip to content

Commit

Permalink
Implemented: searchbar component for centralised usage (hotwax#135)
Browse files Browse the repository at this point in the history
  • Loading branch information
k2maan committed Sep 25, 2023
1 parent 90baab6 commit 8ca619d
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
23 changes: 23 additions & 0 deletions src/components/Searchbar.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<template>
<ion-searchbar
:placeholder='props.placeholder'
:showClearButton="props.showClearButton ? props.showClearButton : 'focus'"
@keyup.enter="search($event.target.value)"
@ionClear="emit('on-clear')"
@ionFocus="emit('on-focus', $event)"
/>
</template>

<script setup lang="ts">
import { IonSearchbar } from '@ionic/vue';
import { defineProps, defineEmits } from 'vue';
const props = defineProps(['placeholder', 'showClearButton'])
// ionClear event is used in the Job Manager app on the Pipeline page hence the on-clear emit
const emit = defineEmits(['update-query-string', 'on-search', 'on-clear', 'on-focus'])
function search(queryString: string) {
emit('update-query-string', queryString)
emit('on-search')
}
</script>
3 changes: 2 additions & 1 deletion src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import '@ionic/vue/css/text-transformation.css';
import '@ionic/vue/css/flex-utils.css';
import '@ionic/vue/css/display.css';

export { default as ProductIdentifier } from "./ProductIdentifier.vue";
export { default as LanguageSwitcher } from './LanguageSwitcher.vue';
export { default as OmsInstanceNavigator } from './OmsInstanceNavigator.vue'
export { default as ProductIdentifier } from "./ProductIdentifier.vue";
export { default as ShopifyImg } from './ShopifyImg.vue';
export { default as Searchbar } from './Searchbar.vue';
10 changes: 9 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@ declare var process: any;
import { createPinia } from "pinia";
import { useProductIdentificationStore } from "./store/productIdentification";
import { useAuthStore } from "./store/auth";
import { LanguageSwitcher, OmsInstanceNavigator, ProductIdentifier, ShopifyImg } from "./components";
import {
LanguageSwitcher,
OmsInstanceNavigator,
ProductIdentifier,
Searchbar,
ShopifyImg,
} from "./components";
import Login from "./components/Login";
import { goToOms } from "./utils";
import { initialiseFirebaseApp } from "./utils/firebase"
Expand Down Expand Up @@ -45,6 +51,7 @@ export let dxpComponents = {
app.component('Login', Login)
app.component('OmsInstanceNavigator', OmsInstanceNavigator)
app.component('ProductIdentifier', ProductIdentifier)
app.component('Searchbar', Searchbar)
app.component('ShopifyImg', ShopifyImg)

loginContext.login = options.login
Expand Down Expand Up @@ -83,6 +90,7 @@ export {
productIdentificationContext,
ShopifyImg,
shopifyImgContext,
Searchbar,
translate,
useAuthStore,
useProductIdentificationStore,
Expand Down

0 comments on commit 8ca619d

Please sign in to comment.