diff options
author | sarahghp <sarah.groff.palermo@gmail.com> | 2019-03-27 21:55:49 +0300 |
---|---|---|
committer | sarahghp <sarah.groff.palermo@gmail.com> | 2019-03-27 22:46:53 +0300 |
commit | e43853dd100926a4dce3216ed7f1122fbf4f2308 (patch) | |
tree | a030ac75a2c2ef516071717ceb7ed997fc45738f | |
parent | 44d8943ebf17b02e96d4b2dc22aed140a39a3f7b (diff) |
Implements suggestions for reusability58712-update-tooltip-on-truncate
-rw-r--r-- | app/assets/javascripts/vue_shared/components/tooltip_on_truncate.vue | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/app/assets/javascripts/vue_shared/components/tooltip_on_truncate.vue b/app/assets/javascripts/vue_shared/components/tooltip_on_truncate.vue index a567ac80464..88ebdfb102f 100644 --- a/app/assets/javascripts/vue_shared/components/tooltip_on_truncate.vue +++ b/app/assets/javascripts/vue_shared/components/tooltip_on_truncate.vue @@ -7,16 +7,21 @@ export default { GlTooltip: GlTooltipDirective, }, props: { - title: { + boundary: { type: String, required: false, - default: '', + default: 'viewport', }, placement: { type: String, required: false, default: 'top', }, + title: { + type: String, + required: false, + default: '', + }, truncateTarget: { type: [String, Function], required: false, @@ -31,6 +36,8 @@ export default { mounted() { const target = this.selectTarget(); + // NOTE: The secondary test allows for strings or spans to be passed + // directly to this component if ( target && (target.scrollWidth > target.offsetWidth || @@ -56,9 +63,8 @@ export default { <template> <span v-if="showTooltip" - v-gl-tooltip="{ boundary: 'viewport', placement }" + v-gl-tooltip="{ boundary, placement }" :title="title" - :data-placement="placement" class="js-show-tooltip" > <slot></slot> |