Skip to content

Commit

Permalink
Merge pull request #74 from casper-network/infobubble-pageblock
Browse files Browse the repository at this point in the history
ADDED: new infobubble pageblock
  • Loading branch information
sd-ditoy authored Nov 3, 2023
2 parents 72197b3 + f02bfea commit 7ef49a6
Show file tree
Hide file tree
Showing 4 changed files with 197 additions and 4 deletions.
11 changes: 11 additions & 0 deletions src/assets/svg/icon-information.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
161 changes: 161 additions & 0 deletions src/components/blocks/InfoBubble.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
<template>
<div class="info-bubble" :class="{ closed }" v-if="text" >
<SVGInfo />
<div v-html="text" />
</div>
</template>

<script>
import SVGInfo from '@/assets/svg/icon-information.svg?inline';
export default {
name: 'InfoBubble',
components: {
SVGInfo,
},
//---------------------------------------------------
//
// Properties
//
//---------------------------------------------------
props: {
text: {
type: String,
default: null,
},
},
//---------------------------------------------------
//
// Data model
//
//---------------------------------------------------
data() {
return {
closed: false,
};
},
//---------------------------------------------------
//
// Computed Properties
//
//---------------------------------------------------
computed: {
},
//---------------------------------------------------
//
// Watch Properties
//
//---------------------------------------------------
watch: {},
//---------------------------------------------------
//
// Filter Properties
//
//---------------------------------------------------
// filters: {},
//---------------------------------------------------
//
// Validation Properties
//
//---------------------------------------------------
// validations: {},
//---------------------------------------------------
//
// Vue Lifecycle
//
//---------------------------------------------------
// beforeCreate() {},
// created() {},
// beforeMount() {},
// render(h) { return h(); },
mounted() {
if (this.text) {
setTimeout(() => {
this.closed = true;
}, 3500);
}
},
// beforeUpdate() {},
// updated() {},
// beforeDestroy() {},
// destroyed() {},
//---------------------------------------------------
//
// Methods
//
//---------------------------------------------------
methods: {
//----------------------------------
// Event Handlers
//----------------------------------
},
};
</script>

<style lang="scss">
@import '~scss/mixins';
.info-bubble {
--size: 48px;
position: fixed;
right: 30px;
bottom: 30px;
border-radius: var(--size);
padding: 12px;
display: flex;
align-items: center;
background-color: var(--color-atomic-lime);
box-shadow: 1px 2px 5px rgba(0,0,0,0.75);
z-index: 10000;
max-width: 100%;
transition: max-width 1.2s ease-in-out;
@include breakpoint('sm') {
right: 10px;
bottom: 10px;
--size: 36px;
font-size: 13px;
}
& > svg {
width: var(--size);
height: var(--size);
min-width: var(--size);
min-height: var(--size);
max-width: var(--size);
max-height: var(--size);
}
& > div {
margin: 0 12px;
display: flex;
align-items: center;
overflow: hidden;
white-space: nowrap;
transition: opacity 1.2s ease-in-out;
opacity: 1;
p {
margin: 0;
font-size: inherit;
line-height: inherit;
padding: 0;
}
}
&.closed {
max-width: var(--size);
& > div {
opacity: 0;
}
&:hover {
max-width: 100%;
& > div {
opacity: 1;
}
}
}
}
</style>
24 changes: 20 additions & 4 deletions src/components/blocks/TextTeaser.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<template>
<div class="text-component" :class="{ margined: setAsH1, reversed: variation === 'text-right', 'is-first': isFirst }" :style="computedStyles">
<div
class="text-component"
:class="{ margined: setAsH1, reversed: variation === 'text-right', 'is-first': isFirst }"
:style="computedStyles">
<div class="container">
<div>
<h1 v-if="setAsH1" class="h1" v-html="boxTitle" :data-slug="slugged" />
Expand Down Expand Up @@ -71,6 +74,10 @@ export default {
type: String,
default: null,
},
linkColor: {
type: String,
default: null,
},
media: {
type: Array,
default: null,
Expand Down Expand Up @@ -102,7 +109,13 @@ export default {
//---------------------------------------------------
computed: {
computedStyles() {
const { bgColor, titleColor, textColor } = this;
const {
bgColor,
titleColor,
textColor,
linkColor,
} = this;
let out = '--hcolor:initial;';
if (titleColor) {
out += `--hcolor:${titleColor};`;
Expand All @@ -111,7 +124,10 @@ export default {
out += `background-color:${bgColor};`;
}
if (textColor) {
out += `color:${textColor}`;
out += `color:${textColor};`;
}
if (linkColor) {
out += `--lcolor:${linkColor};`;
}
return out;
},
Expand Down Expand Up @@ -264,7 +280,7 @@ export default {
a {
font-family: inherit;
font-size: inherit;
color: var(--color-blue);
color: var(--lcolor, var(--color-blue));
text-decoration: underline;
}
}
Expand Down
5 changes: 5 additions & 0 deletions src/views/PageFactory.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
:bg-color="block.bgcolor"
:title-color="block.titlecolor"
:text-color="block.txtcolor"
:link-color="block.linkcolor"
:media="block.media"
:variation="block.variation"
/>
Expand Down Expand Up @@ -171,6 +172,10 @@
:content="block.content"
:services="block.services"
/>
<InfoBubble
v-if="block.blocktype === 'infobubble'"
:text="block.text"
/>
</section>
</main>
</template>
Expand Down

0 comments on commit 7ef49a6

Please sign in to comment.