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