Skip to content

Commit

Permalink
Merge pull request #5957 from Countly/feat-add-tooltips-to-content-si…
Browse files Browse the repository at this point in the history
…debar-input-component

[Feat] Add tooltips to content sidebar input component
  • Loading branch information
pnrgenc authored Jan 28, 2025
2 parents 40219a4 + e850ad0 commit 5e25b4c
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,11 @@
template: CV.T('/javascripts/countly/vue/templates/content/UI/content-sidebar-input.html'),

props: {
componentTooltip: {
default: null,
type: String
},

disabled: {
default: false,
type: Boolean
Expand All @@ -419,6 +424,15 @@
type: String
},

labelIcon: {
default: 'cly-io cly-io-question-mark-circle',
type: String
},
labelTooltip: {
default: null,
type: String
},

options: {
default: () => [],
type: Array
Expand Down Expand Up @@ -457,6 +471,16 @@
size: {
default: null,
type: String
},

withComponentTooltip: {
default: false,
type: Boolean
},

withLabelTooltip: {
default: false,
type: Boolean
}
},

Expand Down Expand Up @@ -498,6 +522,10 @@
return this.isDropdownInput && Array.isArray(this.options) && this.options.length;
},

isLabelTooltipVisible() {
return this.withLabelTooltip && this.labelTooltip;
},

isSliderInput() {
return this.type === COUNTLY_CONTENT_SIDEBAR_INPUT_COMPONENT_BY_TYPE_SLIDER;
},
Expand All @@ -519,6 +547,13 @@

mainComponent() {
return COUNTLY_CONTENT_SIDEBAR_INPUT_COMPONENT_BY_TYPE[this.type] || 'div';
},

tooltip() {
if (this.withComponentTooltip) {
return this.componentTooltip || null;
}
return null;
}
}
}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,18 @@
class="cly-vue-content-builder-sidebar-input__label"
>
{{ label }}
<i
v-if="isLabelTooltipVisible"
v-tooltip.left="labelTooltip"
:class="labelIcon"
/>
</label>
<slot name="content-builder-layout-step">
<component
:is="mainComponent"
v-bind="$attrs"
v-model="componentValue"
v-tooltip.left="tooltip"
class="cly-vue-content-builder-sidebar-input__component"
:class="{ 'cly-vue-content-builder-sidebar-input__component--slider': isSliderInput }"
:controls="controlsProp"
Expand Down
12 changes: 12 additions & 0 deletions frontend/express/public/stylesheets/vue/clyvue.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4745,11 +4745,23 @@

// .cly-vue-content-builder-sidebar-input__label
&__label {
display: flex;
align-items: baseline;
justify-content: flex-start;

flex-shrink: 0;
margin-right: auto;
font-size: 13px;
font-weight: 500;
line-height: 16px;

// .cly-vue-content-builder-sidebar-input__label i
i {
margin-left: 4px;
font-size: 13px;
font-weight: 500;
line-height: 16px;
}
}

// .cly-vue-content-builder-sidebar-input__number-input-suffix
Expand Down

0 comments on commit 5e25b4c

Please sign in to comment.