@@ -7,20 +7,27 @@ const props = defineProps({
77 type: String ,
88 required: false ,
99 },
10+ orientation: {
11+ type: String ,
12+ default: ' vertical' ,
13+ },
1014})
1115
12- const adv = computed (() => {
16+ const adv = ref ({})
17+ const isDisplayed = ref (true )
18+
19+ onMounted (() => {
1320 if (props .advName ) {
14- return getAdvByName (props .advName )
21+ adv . value = getAdvByName (props .advName )
1522 } else {
16- return getRandomAdv ()
23+ adv . value = getRandomAdv ()
1724 }
1825})
1926 </script >
2027
2128<template >
22- <NuxtLink v-if =" adv.link" :to =" adv.link" target =" _blank" >
23- <Flex direction =" column" gap =" 12" :class =" $style.ad " >
29+ <NuxtLink v-if =" adv.link" :to =" adv.link" target =" _blank" :class = " [orientation === 'horizontal' && $style.wrapper_horizontal, !isDisplayed && $style.not_display] " >
30+ <Flex v-if = " orientation === 'vertical' " direction =" column" gap =" 12" :class =" $style.ad_vertical " >
2431 <Flex direction =" column" gap =" 8" >
2532 <Flex align =" center" gap =" 6" >
2633 <Icon v-if =" adv.icon" :name =" adv.icon" size =" 14" color =" brand" />
@@ -30,17 +37,50 @@ const adv = computed(() => {
3037 <Text size =" 13" weight =" 600" color =" tertiary" height =" 140" > {{ adv.body }} </Text >
3138 </Flex >
3239
33- <Text size =" 13" weight =" 600" color =" brand" > {{ adv.footer }} </Text >
40+ <!-- <Text size="13" weight="600" color="brand" :class="$style.footer"> {{ adv.footer }} </Text> -->
41+ <Flex align =" center" justify =" between" >
42+ <Text size =" 13" weight =" 600" color =" brand" :class =" $style.footer" > {{ adv.footer }} </Text >
43+
44+ <Icon @click.prevent.stop =" isDisplayed = false" name =" close" size =" 16" color =" secondary" :class =" $style.close_icon" />
45+ </Flex >
46+ </Flex >
47+ <Flex
48+ v-else-if =" orientation === 'horizontal'"
49+ align =" center"
50+ justify =" between"
51+ gap =" 12"
52+ wide
53+ :class =" $style.ad_horizontal"
54+ >
55+ <Flex align =" center" gap =" 12" >
56+ <Flex align =" center" gap =" 6" >
57+ <Icon v-if =" adv.icon" :name =" adv.icon" size =" 14" color =" brand" />
58+ <Text size =" 13" weight =" 600" color =" primary" > {{ adv.header }} </Text >
59+ </Flex >
60+
61+ <Text size =" 13" weight =" 600" color =" tertiary" height =" 140" > {{ adv.body }} </Text >
62+ </Flex >
63+
64+ <Flex align =" center" gap =" 8" >
65+ <Text size =" 13" weight =" 600" color =" brand" > {{ adv.footer }} </Text >
66+
67+ <Icon @click.prevent.stop =" isDisplayed = false" name =" close" size =" 16" color =" secondary" :class =" $style.close_icon" />
68+ </Flex >
3469 </Flex >
3570 </NuxtLink >
3671</template >
3772
3873<style module>
39- .wrapper {
40- width : fit-content ;
74+ .wrapper_horizontal {
75+ width : 100% ;
76+ padding : 8px 24px 0px 24px ;
4177}
4278
43- .ad {
79+ .not_display {
80+ display : none ;
81+ }
82+
83+ .ad_vertical {
4484 position : relative ;
4585
4686 border-radius : 12px ;
@@ -52,19 +92,60 @@ const adv = computed(() => {
5292
5393 &:hover {
5494 background : var (--op-3 );
95+
96+ .close _icon {
97+ display : block ;
98+ }
99+ }
100+
101+ & .footer {
102+ padding : 2px ;
103+ }
104+ & .close_icon {
105+ display : none ;
106+ padding : 2px ;
107+
108+ border-radius : 12px ;
109+
110+ transition : all 0.2s ease ;
111+
112+ &:hover {
113+ background : var (--op-10 );
114+ transform : scale (1.1 );
115+ }
116+ }
117+ }
118+
119+ .ad_horizontal {
120+ position : relative ;
121+ width : 100% ;
122+
123+ border-radius : 12px ;
124+ box-shadow : inset 0 0 0 2px var (--op-10 );
125+
126+ padding : 8px 16px ;
127+
128+ transition : all 0.2s ease ;
129+
130+ &:hover {
131+ background : var (--op-3 );
132+
133+ .close _icon {
134+ display : block ;
135+ }
55136 }
56137
57138 & .close_icon {
58- position : absolute ;
59- top : 16px ;
60- right : 16px ;
139+ display : none ;
140+ padding : 2px ;
61141
62- cursor : pointer ;
142+ border-radius : 12 px ;
63143
64144 transition : all 0.2s ease ;
65145
66146 &:hover {
67- fill : var (--txt-secondary );
147+ background : var (--op-10 );
148+ transform : scale (1.1 );
68149 }
69150 }
70151}
0 commit comments