Created
January 28, 2020 17:53
-
-
Save alejovdev/423be59825219c6bc4c6cf954bb694b8 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<script> | |
export let dark; | |
function handleToggle() { | |
dark = !dark; | |
} | |
</script> | |
<style> | |
.container { | |
width: 100%; | |
height: 100%; | |
display: flex; | |
justify-content: center; | |
align-items: center; | |
} | |
.toggle { | |
border: none; | |
outline: none; | |
border-radius: 5px; | |
padding: 10px; | |
color: white; | |
} | |
.toggle:hover { | |
cursor: pointer; | |
} | |
.dark { | |
background-color: #3b5998; | |
color: white; | |
} | |
.light { | |
background-color: #ffffff; | |
color: black; | |
} | |
</style> | |
<div class="container {dark ? 'dark' : 'light'}"> | |
<button class="toggle {dark ? 'light' : 'dark'}" on:click={handleToggle}> | |
Toggle background | |
</button> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment