Skip to content

Commit

Permalink
fix: Align interactive toggle button on top of widgets
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Härtl <[email protected]>
  • Loading branch information
juliusknorr committed Mar 4, 2024
1 parent 09c2b57 commit cd572fb
Showing 1 changed file with 29 additions and 5 deletions.
34 changes: 29 additions & 5 deletions src/components/NcRichText/NcReferenceWidget.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div>
<div :class="{'toggle-interactive': hasInteractiveView && !isInteractive }">
<div v-if="reference && hasCustomWidget" ref="customWidget" class="widget-custom" />

<component :is="referenceWidgetLinkComponent"
Expand All @@ -9,12 +9,18 @@
class="widget-default">
<img v-if="reference.openGraphObject.thumb" class="widget-default--image" :src="reference.openGraphObject.thumb">
<div class="widget-default--details">
<p class="widget-default--name">{{ reference.openGraphObject.name }}</p>
<p class="widget-default--description" :style="descriptionStyle">{{ reference.openGraphObject.description }}</p>
<p class="widget-default--link">{{ compactLink }}</p>
<p class="widget-default--name">
{{ reference.openGraphObject.name }}
</p>
<p class="widget-default--description" :style="descriptionStyle">
{{ reference.openGraphObject.description }}
</p>
<p class="widget-default--link">
{{ compactLink }}
</p>
</div>
</component>
<NcButton v-if="hasInteractiveView && !isInteractive" @click="enableInteractive">
<NcButton v-if="hasInteractiveView && !isInteractive" class="toggle-interactive--button" @click="enableInteractive">
Enable interative mode
</NcButton>
</div>
Expand Down Expand Up @@ -245,4 +251,22 @@ export default {
white-space: nowrap;
}
}
.toggle-interactive {
position: relative;
.toggle-interactive--button {
position: absolute;
top: 50%;
z-index: 10000;
left: 50%;
transform: translateX(-50%) translateY(-50%);
opacity: 0;
}
&:focus-within, &:hover {
.toggle-interactive--button {
opacity: 1;
}
}
}
</style>

0 comments on commit cd572fb

Please sign in to comment.