Skip to content

Instantly share code, notes, and snippets.

@gdotdesign
Created March 16, 2020 09:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gdotdesign/05f3ea3e23bcfbf3c4a7fce1b6d1ed88 to your computer and use it in GitHub Desktop.
Save gdotdesign/05f3ea3e23bcfbf3c4a7fce1b6d1ed88 to your computer and use it in GitHub Desktop.
Mint media provider example.
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