mobilizon.chapril.org-mobil.../js/src/components/SearchField.vue
Thomas Citharel 4144e9ffd0
Introduce group basic federation, event new page and notifications
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
2020-06-03 16:01:26 +02:00

53 lines
1.0 KiB
Vue

<template>
<label>
<span class="visually-hidden">{{ defaultPlaceHolder }}</span>
<b-input
custom-class="searchField"
icon="magnify"
type="search"
rounded
:placeholder="defaultPlaceHolder"
v-model="searchText"
@keyup.native.enter="enter"
/>
</label>
</template>
<script lang="ts">
import { Component, Prop, Vue } from "vue-property-decorator";
import RouteName from "../router/name";
@Component
export default class SearchField extends Vue {
@Prop({ type: String, required: false }) placeholder!: string;
searchText = "";
enter() {
this.$router.push({
name: RouteName.SEARCH,
params: { searchTerm: this.searchText },
});
}
get defaultPlaceHolder(): string {
// We can't use "this" inside @Prop's default value.
return this.placeholder || (this.$t("Search") as string);
}
}
</script>
<style lang="scss">
label span.visually-hidden {
display: none;
}
input.searchField {
box-shadow: none;
border-color: #b5b5b5;
&::placeholder {
color: gray;
}
}
</style>