Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,10 @@
:class="$computedClass(buttonStyle)"
:aria-label="ariaLabel"
@click.stop.prevent="$emit('click')"
@mouseenter="hovered = true"
@mouseleave="hovered = false"
>
<KIcon
icon="helpOutline"
:color="$themePalette.blue.v_500"
class="icon-outline"
/>
<KIcon
icon="help"
:color="$themePalette.blue.v_500"
class="icon-full"
<HelpIcon
iconOutlineName="helpOutline"
iconFullName="help"
/>
</button>

Expand All @@ -24,19 +16,19 @@

<script>

import HelpIcon from './HelpIcon.vue';

export default {
name: 'HelpButton',
components: {
HelpIcon,
},
props: {
ariaLabel: {
type: String,
required: true,
},
},
data() {
return {
hovered: false,
};
},
computed: {
buttonStyle() {
return {
Expand All @@ -59,35 +51,15 @@
width: $toucharea-min-width;
height: $toucharea-min-width;
cursor: pointer;
}

button:hover {
.icon-full {
opacity: 1;
/* Ensure HelpIcon inherits button's hover state for its own hover effects */
&:hover .help-icon-wrapper {
.icon-full {
opacity: 1;
}
.icon-outline {
opacity: 0;
}
}

.icon-outline {
opacity: 0;
}
}

.icon-outline,
.icon-full {
position: absolute;
top: 50%;
left: 50%;

/* few extra pixels needed to achieve 16px icon size
due to extra padding in source svg */
width: 19.2px;
height: 19.2px;
transition: opacity 0.4s ease;
transform: translate(-50%, -50%);
}

.icon-full {
z-index: 1;
opacity: 0;
}

</style>
67 changes: 67 additions & 0 deletions contentcuration/contentcuration/frontend/shared/views/HelpIcon.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<template>
<span class="help-icon-wrapper">
<KIcon
:icon="iconOutlineName"
:color="$themePalette.blue.v_500"
class="icon-outline"
/>
<KIcon
:icon="iconFullName"
:color="$themePalette.blue.v_500"
class="icon-full"
/>
</span>
</template>

<script>
export default {
name: 'HelpIcon',
props: {
iconOutlineName: {
type: String,
required: true,
},
iconFullName: {
type: String,
required: true,
},
},
};
</script>

<style lang="scss" scoped>
.help-icon-wrapper {
position: relative;
display: inline-block;
width: 100%; /* Take width from parent */
height: 100%; /* Take height from parent */
}

.help-icon-wrapper:hover {
.icon-full {
opacity: 1;
}

.icon-outline {
opacity: 0;
}
}

.icon-outline,
.icon-full {
position: absolute;
top: 50%;
left: 50%;
/* few extra pixels needed to achieve 16px icon size
due to extra padding in source svg */
width: 19.2px;
height: 19.2px;
transition: opacity 0.4s ease;
transform: translate(-50%, -50%);
}

.icon-full {
z-index: 1;
opacity: 0;
}
</style>
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,9 @@
class="icons-wrapper"
:aria-label="text"
>
<KIcon
icon="infoOutline"
:color="$themePalette.blue.v_500"
class="icon-outline"
/>
<KIcon
icon="info"
:color="$themePalette.blue.v_500"
class="icon-full"
<HelpIcon
iconOutlineName="infoOutline"
iconFullName="info"
/>
</span>
<KTooltip
Expand All @@ -34,9 +28,13 @@

<script>

import HelpIcon from './HelpIcon.vue';

export default {
name: 'HelpTooltip',

components: {
HelpIcon,
},
props: {
text: {
type: String,
Expand Down Expand Up @@ -64,35 +62,15 @@
display: inline-block;
width: 100%;
height: 100%;
}

.icons-wrapper:hover {
.icon-full {
opacity: 1;
/* Ensure HelpIcon inherits hover state for its own hover effects */
&:hover .help-icon-wrapper {
.icon-full {
opacity: 1;
}
.icon-outline {
opacity: 0;
}
}

.icon-outline {
opacity: 0;
}
}

.icon-outline,
.icon-full {
position: absolute;
top: 50%;
left: 50%;

/* few extra pixels needed to achieve 16px icon size
due to extra padding in source svg */
width: 19.2px;
height: 19.2px;
transition: opacity 0.4s ease;
transform: translate(-50%, -50%);
}

.icon-full {
z-index: 1;
opacity: 0;
}

</style>
Loading