Skip to content

Commit 791e1de

Browse files
committed
Merge #625: Add option to close banner
37d1466 refactor: layout adjusted (Mario) 7a85ba5 refactor: close banner icon now is centered (Mario) c0ab028 feat: added cursor pointer (Mario) a1dd945 feat: added option to close banner (Mario) Pull request description: Banner could use a button to allow the user to close it. ACKs for top commit: josecelano: ACK 37d1466 Tree-SHA512: 25e74007450b630c8724cb55b4ec1b38e890f2a24a6f9583d5155074baf09647b5dd8a44e13ee948f57849001e7f71df9b43097f7ed02fb5d4770dc5a1b7ee90
2 parents 8cb8668 + 37d1466 commit 791e1de

File tree

1 file changed

+34
-7
lines changed

1 file changed

+34
-7
lines changed

components/demo/Banner.vue

+34-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,21 @@
11
<template>
2-
<div v-if="isDemoMode" class="demo-banner">
3-
{{ warning }}<NuxtLink to="/terms">
4-
Read our terms.</NuxtLink>
2+
<div v-if="isDemoMode" id="banner" class="demo-banner">
3+
<div id="termsWarning"> {{ warning }}<NuxtLink to="/terms">
4+
Read our terms.</NuxtLink></div>
5+
<div id="closeButton"> <svg
6+
xmlns="http://www.w3.org/2000/svg"
7+
width="24"
8+
height="24"
9+
viewBox="0 0 24 24"
10+
fill="none"
11+
stroke="currentColor"
12+
stroke-width="2"
13+
stroke-linecap="round"
14+
stroke-linejoin="round"
15+
class="feather feather-x cursor-pointer"
16+
@click="closeBanner()"
17+
><line x1="18" y1="6" x2="6" y2="18" /><line x1="6" y1="6" x2="18" y2="18" />
18+
</svg></div>
519
</div>
620
</template>
721

@@ -27,18 +41,31 @@ watch(
2741
{ immediate: true }
2842
);
2943
44+
function closeBanner () {
45+
document.getElementById("banner").style.display = "none";
46+
}
47+
3048
</script>
3149

3250
<style scoped>
3351
.demo-banner {
3452
background-color: #f5b14a;
3553
color: #000;
36-
width: 100%;
3754
padding: 10px;
3855
text-align: center;
39-
/*position: fixed;*/
40-
top: 0;
41-
left: 0;
56+
width: 100%;
4257
z-index: 1000;
58+
display: flex;
59+
justify-content: center;
60+
align-items: center;
61+
}
62+
63+
#closeButton {
64+
padding-inline: 10px;
65+
}
66+
67+
.feather:hover {
68+
stroke: rgb(255, 255, 255);
69+
stroke-opacity: 75%;
4370
}
4471
</style>

0 commit comments

Comments
 (0)