Macro sauron_core::prelude::jss_ns
source · macro_rules! jss_ns { ($namespace: tt, $($tokens:tt)+) => { ... }; }
Expand description
Create a css string using json notation and use namespace on the class selectors
use jss::units::percent;
let css = jss::jss_ns!("frame3",
".": {
display: "block",
},
".layer": {
background_color: "red",
border: "1px solid green",
},
"@media screen and (max-width: 900px)": {
".layer": {
width: percent(100),
}
},
".hide .layer": {
opacity: 0,
},
);
let expected = r#".frame3{display:block;}.frame3__layer{background-color:red;border:1px solid green;}@media screen and (max-width: 900px){.frame3__layer{width:100%;}}.frame3__hide .frame3__layer{opacity:0;}"#;
assert_eq!(expected, css);