Skip to content

Conversation

@mattesmohr
Copy link
Member

@mattesmohr mattesmohr commented Oct 28, 2024

This pull request adds statements to the environment allowing views to be shown based on conditional terms or to loop over a sequence within an environment context, while it is unfortunately not feasible with native statements.

Environment.check(user.loggedIn) {
   Paragraph {
      "True"
   }
}

Environment.check(user.lastName == "Polo" && user.firstName == "Marco") {
   Paragraph {
      "True"
   }
} then: {
   Paragraph {
      "False"
   }
}

Environment.loop(user.roles) { role in
   Paragraph {
      role
   }
}

Environment.unwrap(user.avatar) { avatar in
   Image()
      .source(avatar)
} then: {
   Paragraph {
      "No image found"
   }
}

I also want to state that I am not completely satisfied with the naming yet and may change it in the future.

@mattesmohr mattesmohr marked this pull request as ready for review January 10, 2025 19:18
@mattesmohr mattesmohr merged commit 8d87959 into main Jan 10, 2025
1 check passed
@mattesmohr mattesmohr deleted the extend-the-environment branch January 10, 2025 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant