Skip to content

Commit 57431ee

Browse files
committed
Refactored maxwidth to popoverstyle property
1 parent 8ec07e1 commit 57431ee

File tree

1 file changed

+12
-21
lines changed

1 file changed

+12
-21
lines changed

lib/components/popover.vue

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div>
33
<span ref="trigger"><slot></slot></span>
44

5-
<div tabindex="-1" :class="['popover',popoverAlignment]" ref="popover" @focus="$emit('focus')" @blur="$emit('blur')" v-bind:style="popoverMaxWidth">
5+
<div tabindex="-1" :class="['popover',popoverAlignment]" ref="popover" @focus="$emit('focus')" @blur="$emit('blur')" :style="setPopoverStyle">
66
<div class="popover-arrow"></div>
77
<h3 class="popover-title" v-if="title" v-html="title"></h3>
88
<div class="popover-content">
@@ -103,12 +103,14 @@
103103
return value >= 0;
104104
}
105105
},
106-
maxwidth: {
107-
type: String,
108-
default: 'sm',
106+
popoverStyle: {
107+
type: Object,
108+
default() {
109+
return null;
110+
},
109111
validator(value) {
110-
return ['v-sm', 'sm', 'md', 'lg', 'v-lg'].indexOf(value) !== -1;
111-
}
112+
return typeof value === 'object';
113+
},
112114
}
113115
},
114116
@@ -172,22 +174,11 @@
172174
targetAttachment: this.placementParameters.targetAttachment
173175
};
174176
},
175-
176-
//Sets max-width manually for each option
177-
popoverMaxWidth() {
178-
var sizing = {
179-
'v-sm': '75px',
180-
'sm': '276px',
181-
'md': '450px',
182-
'lg': '575px',
183-
'v-lg': '750px',
184-
};
185-
186-
return {
187-
'max-width': sizing[this.maxwidth],
188-
};
189-
}
190177
178+
setPopoverStyle() {
179+
return this.popoverStyle;
180+
},
181+
191182
},
192183
193184
watch: {

0 commit comments

Comments
 (0)