Skip to content

Instantly share code, notes, and snippets.

@jakedohm
Last active May 15, 2019 11:51
Show Gist options
  • Save jakedohm/f270c4b5a3992f07147c7a8b591ee015 to your computer and use it in GitHub Desktop.
Save jakedohm/f270c4b5a3992f07147c7a8b591ee015 to your computer and use it in GitHub Desktop.
Vue Component to Dim Screen
<template>
<!-- Example Usage -->
<div class="menu">
<ScreenDimmer :visible="menuOpen" />
</div>
</template>
<script>
export default {
data() {
return {
menuOpen: false
}
}
}
</script>
<template>
<div
class="fixed pin z-1 bg-black ts"
:class="[visible ? 'opacity-75' : 'opacity-0 pointer-events-none']"
></div>
</template>
<script>
export default {
props: {
visible: Boolean,
},
}
</script>
@jakedohm
Copy link
Author

The classes used in this example component are based on tailwindCSS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment