-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(vote): ♻️ extract mask component
- Loading branch information
Showing
12 changed files
with
81 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<template> | ||
<Transition name="mask"> | ||
<div | ||
v-if="open" | ||
class="fixed inset-0 backdrop-filter backdrop-blur-sm" | ||
:style="'z-index:' + props.zIndex" | ||
@click="closeMask()" | ||
@touchmove.stop.prevent | ||
/> | ||
</Transition> | ||
</template> | ||
<script setup lang="ts"> | ||
import { useVModel } from '@vueuse/core' | ||
const props = defineProps({ | ||
open: { | ||
type: Boolean, | ||
default: true, | ||
}, | ||
clickToClose: { | ||
type: Boolean, | ||
default: false, | ||
}, | ||
zIndex: { | ||
type: Number, | ||
default: 50, | ||
}, | ||
}) | ||
const emit = defineEmits<{ | ||
(event: 'update:open', value: boolean): void | ||
}>() | ||
const open = useVModel(props, 'open', emit) | ||
function closeMask() { | ||
props.clickToClose && (open.value = false) | ||
} | ||
</script> | ||
|
||
<style lang="postcss" scoped> | ||
.mask-enter-active, | ||
.mask-leave-active { | ||
transition: opacity 0.2s ease; | ||
} | ||
.mask-enter-from, | ||
.mask-leave-to { | ||
opacity: 0; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.