22/** Services */
33import { getAdvByName , getRandomAdv } from " @/services/constants/advertising"
44
5+ /** Store */
6+ import { useModalsStore } from " ~/store/modals"
7+ const modalsStore = useModalsStore ()
8+
59const props = defineProps ({
610 advName: {
711 type: String ,
@@ -16,6 +20,14 @@ const props = defineProps({
1620const adv = ref ({})
1721const isDisplayed = ref (true )
1822
23+ const handleClick = () => {
24+ if (adv .value .link ) {
25+ window .open (adv .value .link , ' _blank' )
26+ } else if (adv .value .modal ) {
27+ modalsStore .open (adv .value .modal )
28+ }
29+ }
30+
1931onMounted (() => {
2032 if (props .advName ) {
2133 adv .value = getAdvByName (props .advName )
@@ -26,7 +38,7 @@ onMounted(() => {
2638 </script >
2739
2840<template >
29- <NuxtLink v-if =" adv.link " :to = " adv.link " target = " _blank " :class =" [orientation === 'horizontal' && $style.wrapper_horizontal, !isDisplayed && $style.not_display]" >
41+ <Flex v-if =" adv.name " @click = " handleClick() " :class =" [$style.wrapper, orientation === 'horizontal' && $style.wrapper_horizontal, !isDisplayed && $style.not_display]" >
3042 <Flex v-if =" orientation === 'vertical'" direction =" column" gap =" 12" :class =" $style.ad_vertical" >
3143 <Flex direction =" column" gap =" 8" >
3244 <Flex align =" center" gap =" 6" >
@@ -37,7 +49,6 @@ onMounted(() => {
3749 <Text size =" 13" weight =" 600" color =" tertiary" height =" 140" > {{ adv.body }} </Text >
3850 </Flex >
3951
40- <!-- <Text size="13" weight="600" color="brand" :class="$style.footer"> {{ adv.footer }} </Text> -->
4152 <Flex align =" center" justify =" between" >
4253 <Text size =" 13" weight =" 600" color =" brand" :class =" $style.footer" > {{ adv.footer }} </Text >
4354
@@ -67,10 +78,16 @@ onMounted(() => {
6778 <Icon @click.prevent.stop =" isDisplayed = false" name =" close" size =" 16" color =" secondary" :class =" $style.close_icon" />
6879 </Flex >
6980 </Flex >
70- </NuxtLink >
81+ </Flex >
7182</template >
7283
7384<style module>
85+ .wrapper {
86+ width : 100% ;
87+
88+ cursor : pointer ;
89+ }
90+
7491.wrapper_horizontal {
7592 width : 100% ;
7693 padding : 8px 24px 0px 24px ;
@@ -149,4 +166,10 @@ onMounted(() => {
149166 }
150167 }
151168}
169+
170+ @media (max-width : 500px ) {
171+ .wrapper_horizontal {
172+ padding : 12px ;
173+ }
174+ }
152175 </style >
0 commit comments