Skip to content

Commit

Permalink
input-group and input-group-addon support (#266)
Browse files Browse the repository at this point in the history
  • Loading branch information
tmorehouse authored and pi0 committed Apr 21, 2017
1 parent 69c1f26 commit f825c86
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import bAlert from './alert.vue';
import bBreadcrumb from './breadcrumb.vue';
import bButton from './button.vue';
import bButtonGroup from './button-group.vue';
import bInputGroup from './input-group.vue';
import bInputGroupAddon from './input-group-addon.vue';
import bCard from './card.vue';
import bCardGroup from './card-group.vue';
import bCarousel from './carousel.vue';
Expand Down Expand Up @@ -45,6 +47,8 @@ export {
bButton,
bButton as bBtn,
bButtonGroup,
bInputGroup,
bInputGroupAddon,
bCard,
bCardGroup,
bDropdown,
Expand Down
22 changes: 22 additions & 0 deletions lib/components/input-group-addon.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

<template>
<span class="input-group-addon" :id="thisId">
<slot></slot>
</span>
</template>

<script>
export default {
computed: {
thisId() {
return this.id || ('b_input_group_addon_' + this._uid);
}
},
props: {
id: {
type: String,
default: null
}
}
};
</script>
46 changes: 46 additions & 0 deletions lib/components/input-group.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<template>
<div :class="classObject">
<slot name="left">
<b-input-group-addon v-if="left" v-html="left"></b-input-group-addon>
</slot>
<slot></slot>
<slot name="right">
<b-input-group-addon v-if="right" v-html="right"></b-input-group-addon>
</slot>
</div>
</template>

<script>
import bInputGroupAddon from './input-group-addon.vue';
export default {
components: {bInputGroupAddon},
computed: {
classObject() {
return [
'input-group',
this.size ? ('input-group-' + this.size) : '',
this.state ? ('has-' + this.state) : ''
];
}
},
props: {
size: {
type: String,
default: null
},
state: {
type: String,
default: null
},
left: {
type: String,
default: null
},
right: {
type: String,
default: null
}
}
};
</script>

0 comments on commit f825c86

Please sign in to comment.