Created
March 16, 2020 09:05
-
-
Save gdotdesign/05f3ea3e23bcfbf3c4a7fce1b6d1ed88 to your computer and use it in GitHub Desktop.
Mint media provider example.
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
component Main { | |
state mobile : Bool = false | |
use Provider.MediaQuery { | |
query = "(max-width: 1000px)", | |
changes = | |
(matches : Bool) : Promise(Never, Void) { | |
next { mobile = matches } | |
} | |
} | |
style base { | |
if (mobile) { | |
color: blue; | |
} else { | |
color: red; | |
} | |
} | |
fun render : Html { | |
<div::base> | |
"Hello" | |
</div> | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment