Merge branch 'many_optional_attributes' into pr/atty303/1349
This commit is contained in:
commit
9e167dfdb7
16 files changed
+553
-319
No files matched your search
@@ -53,6 +53,7 @@ fn App(cx: Scope) -> Element {
|
||||
let formatting = "formatting!";
|
||||
let formatting_tuple = ("a", "b");
|
||||
let lazy_fmt = format_args!("lazily formatted text");
|
||||
let asd = 123;
|
||||
cx.render(rsx! {
|
||||
div {
|
||||
// Elements
|
||||
@@ -80,6 +81,10 @@ fn App(cx: Scope) -> Element {
|
||||
// pass simple rust expressions in
|
||||
class: lazy_fmt,
|
||||
id: format_args!("attributes can be passed lazily with std::fmt::Arguments"),
|
||||
class: "asd",
|
||||
class: "{asd}",
|
||||
// if statements can be used to conditionally render attributes
|
||||
class: if formatting.contains("form") { "{asd}" },
|
||||
div {
|
||||
class: {
|
||||
const WORD: &str = "expressions";
|
||||
|
||||
@@ -14,9 +14,13 @@ fn main() {
|
||||
}
|
||||
|
||||
pub fn app(cx: Scope) -> Element {
|
||||
let grey_background = true;
|
||||
cx.render(rsx!(
|
||||
div {
|
||||
header { class: "text-gray-400 bg-gray-900 body-font",
|
||||
header {
|
||||
class: "text-gray-400 body-font",
|
||||
// you can use optional attributes to optionally apply a tailwind class
|
||||
class: if grey_background { "bg-gray-900" },
|
||||
div { class: "container mx-auto flex flex-wrap p-5 flex-col md:flex-row items-center",
|
||||
a { class: "flex title-font font-medium items-center text-white mb-4 md:mb-0",
|
||||
StacksIcon {}
|
||||
|
||||
Reference in new issue
Block a user