SurenNeware | 71724be | 2020-06-01 15:31:00 +0530 | [diff] [blame] | 1 | <template> |
| 2 | <div class="search-global"> |
| 3 | <b-form-group |
| 4 | :label="$t('global.form.search')" |
| 5 | label-for="searchInput" |
| 6 | label-sr-only |
| 7 | class="mb-2" |
| 8 | > |
| 9 | <b-input-group size="md" class="align-items-center"> |
| 10 | <b-input-group-prepend> |
| 11 | <icon-search class="search-icon" /> |
| 12 | </b-input-group-prepend> |
| 13 | <b-form-input |
| 14 | id="searchInput" |
| 15 | v-model="filter" |
| 16 | type="text" |
| 17 | :placeholder="placeholder" |
| 18 | @input="onChangeInput" |
| 19 | ></b-form-input> |
| 20 | </b-input-group> |
| 21 | </b-form-group> |
| 22 | </div> |
| 23 | </template> |
| 24 | |
| 25 | <script> |
| 26 | import IconSearch from '@carbon/icons-vue/es/search/16'; |
| 27 | export default { |
| 28 | name: 'Search', |
| 29 | components: { IconSearch }, |
| 30 | props: { |
| 31 | placeholder: { |
| 32 | type: String, |
Yoshie Muranaka | 83458ae | 2020-06-18 14:01:57 -0700 | [diff] [blame] | 33 | default: function() { |
SurenNeware | 71724be | 2020-06-01 15:31:00 +0530 | [diff] [blame] | 34 | return this.$t('global.form.search'); |
| 35 | } |
| 36 | } |
| 37 | }, |
| 38 | data() { |
| 39 | return { |
| 40 | filter: null |
| 41 | }; |
| 42 | }, |
| 43 | methods: { |
| 44 | onChangeInput() { |
| 45 | this.$emit('changeSearch', this.filter); |
| 46 | } |
| 47 | } |
| 48 | }; |
| 49 | </script> |
| 50 | |
| 51 | <style lang="scss" scoped> |
| 52 | @import 'src/assets/styles/helpers'; |
| 53 | |
| 54 | #searchInput { |
| 55 | padding-left: ($spacer * 2); |
| 56 | } |
| 57 | .search-icon { |
| 58 | position: absolute; |
| 59 | left: 10px; |
| 60 | top: 12px; |
| 61 | z-index: 4; |
Yoshie Muranaka | 01da818 | 2020-07-08 15:46:43 -0700 | [diff] [blame^] | 62 | stroke: gray('400'); |
SurenNeware | 71724be | 2020-06-01 15:31:00 +0530 | [diff] [blame] | 63 | } |
| 64 | </style> |