Allow HTML Injection into ft-icon-button component

This commit is contained in:
Preston 2020-06-16 23:01:13 -04:00
parent 72784a684b
commit 12272cf49f
4 changed files with 40 additions and 18 deletions

View File

@ -78,7 +78,7 @@
color: var(--secondary-text-color); color: var(--secondary-text-color);
} }
.iconDropdown p { .iconDropdown .dropdownItem {
padding: 10px; padding: 10px;
margin: 0; margin: 0;
white-space: nowrap; white-space: nowrap;
@ -88,21 +88,21 @@
transition: background 0.2s ease-out; transition: background 0.2s ease-out;
} }
.iconDropdown p:hover { .iconDropdown .dropdownItem:hover {
background-color: var(--side-nav-hover-color); background-color: var(--side-nav-hover-color);
-moz-transition: background 0.2s ease-in; -moz-transition: background 0.2s ease-in;
-o-transition: background 0.2s ease-in; -o-transition: background 0.2s ease-in;
transition: background 0.2s ease-in; transition: background 0.2s ease-in;
} }
.iconDropdown p:active { .iconDropdown .dropdownItem:active {
background-color: var(--side-nav-active-color); background-color: var(--side-nav-active-color);
-moz-transition: background 0.1s ease-in; -moz-transition: background 0.1s ease-in;
-o-transition: background 0.1s ease-in; -o-transition: background 0.1s ease-in;
transition: background 0.1s ease-in; transition: background 0.1s ease-in;
} }
.iconDropdown p a { .iconDropdown .dropdownItem a {
text-decoration: none; text-decoration: none;
color: inherit; color: inherit;
} }
@ -114,3 +114,8 @@
.right { .right {
left: 50%; left: 50%;
} }
.top {
margin-top: 0px;
bottom: 60px;
}

View File

@ -19,10 +19,18 @@ export default Vue.extend({
type: Boolean, type: Boolean,
default: true default: true
}, },
dropdownPosition: { forceDropdown: {
type: Boolean,
default: false
},
dropdownPositionX: {
type: String, type: String,
default: 'center' default: 'center'
}, },
dropdownPositionY: {
type: String,
default: 'bottom'
},
dropdownNames: { dropdownNames: {
type: Array, type: Array,
default: () => { return [] } default: () => { return [] }
@ -43,7 +51,7 @@ export default Vue.extend({
}, },
handleIconClick: function () { handleIconClick: function () {
if (this.dropdownNames.length > 0 && this.dropdownValues.length > 0) { if (this.forceDropdown || (this.dropdownNames.length > 0 && this.dropdownValues.length > 0)) {
this.toggleDropdown() this.toggleDropdown()
} else { } else {
this.$emit('click') this.$emit('click')

View File

@ -13,21 +13,30 @@
@click="handleIconClick" @click="handleIconClick"
/> />
<div <div
v-if="dropdownNames.length > 0 && showDropdown" v-if="showDropdown"
class="iconDropdown" class="iconDropdown"
:class="{ :class="{
left: dropdownPosition === 'left', left: dropdownPositionX === 'left',
right: dropdownPosition === 'right', right: dropdownPositionX === 'right',
center: dropdownPosition === 'center' center: dropdownPositionX === 'center',
bottom: dropdownPositionY === 'bottom',
top: dropdownPositionY === 'top'
}" }"
> >
<p <slot>
v-for="(label, index) in dropdownNames" <div
:key="index" v-if="dropdownNames.length > 0"
@click="handleDropdownClick(index)" >
> <p
{{ label }} v-for="(label, index) in dropdownNames"
</p> :key="index"
class="dropdownItem
@click="handleDropdownClick(index)"
>
{{ label }}
</p>
</div>
</slot>
</div> </div>
</div> </div>
</template> </template>

View File

@ -42,7 +42,7 @@
title="More Options" title="More Options"
theme="base" theme="base"
:use-shadow="false" :use-shadow="false"
dropdown-position="left" dropdown-position-x="left"
:dropdown-names="optionsNames" :dropdown-names="optionsNames"
:dropdown-values="optionsValues" :dropdown-values="optionsValues"
@click="handleOptionsClick" @click="handleOptionsClick"