Fixed sidebar close icon position

pull/345/head
cagataycivici 2020-05-13 01:05:50 +03:00
parent 7c43b96456
commit 7830bad80c
2 changed files with 25 additions and 11 deletions

View File

@ -1,10 +1,12 @@
<template> <template>
<transition name="p-sidebar" @enter="onEnter" @leave="onLeave"> <transition name="p-sidebar" @enter="onEnter" @leave="onLeave">
<div :class="containerClass" v-if="visible" ref="container" role="complementary" :aria-modal="modal"> <div :class="containerClass" v-if="visible" ref="container" role="complementary" :aria-modal="modal">
<button class="p-sidebar-close p-link" @click="hide" :aria-label="ariaCloseLabel" v-if="showCloseIcon" type="button"> <div class="p-sidebar-content">
<span class="p-sidebar-close-icon pi pi-times" /> <button class="p-sidebar-close p-link" @click="hide" :aria-label="ariaCloseLabel" v-if="showCloseIcon" type="button">
</button> <span class="p-sidebar-close-icon pi pi-times" />
<slot></slot> </button>
<slot></slot>
</div>
</div> </div>
</transition> </transition>
</template> </template>
@ -141,6 +143,19 @@ export default {
transition: transform .3s; transition: transform .3s;
} }
.p-sidebar-content {
position: relative;
}
.p-sidebar-close {
position: absolute;
top: 0;
right: 0;
display: flex;
align-items: center;
justify-content: center;
}
.p-sidebar-mask { .p-sidebar-mask {
background-color: transparent; background-color: transparent;
transition-property: background-color; transition-property: background-color;
@ -247,13 +262,6 @@ export default {
height: 30em; height: 30em;
} }
.p-sidebar-close.p-link {
margin-left: auto;
display: flex;
align-items: center;
justify-content: center;
}
@media screen and (max-width: 64em) { @media screen and (max-width: 64em) {
.p-sidebar-left.p-sidebar-lg, .p-sidebar-left.p-sidebar-lg,
.p-sidebar-left.p-sidebar-md, .p-sidebar-left.p-sidebar-md,

View File

@ -67,3 +67,9 @@ export default {
} }
} }
</script> </script>
<style lang="scss" scoped>
h1 {
margin-top: 0;
}
</style>