(integration: I) -> Self {
+ Self(Arc::new(integration))
+ }
+
+ pub fn render(&self, action: &ActionForms) -> AnyView {
+ self.0.render(action)
+ }
+}
diff --git a/packages/styles/shield-bootstrap/Cargo.toml b/packages/styles/shield-bootstrap/Cargo.toml
index 020264a..6ab4c09 100644
--- a/packages/styles/shield-bootstrap/Cargo.toml
+++ b/packages/styles/shield-bootstrap/Cargo.toml
@@ -10,8 +10,11 @@ version.workspace = true
[features]
dioxus = ["dep:dioxus", "dep:shield-dioxus"]
+leptos = ["dep:leptos", "dep:shield-leptos"]
[dependencies]
dioxus = { workspace = true, optional = true }
+leptos = { workspace = true, optional = true }
shield.workspace = true
shield-dioxus = { workspace = true, optional = true }
+shield-leptos = { workspace = true, optional = true }
diff --git a/packages/styles/shield-bootstrap/src/dioxus.rs b/packages/styles/shield-bootstrap/src/dioxus.rs
index db6b0eb..d8bd247 100644
--- a/packages/styles/shield-bootstrap/src/dioxus.rs
+++ b/packages/styles/shield-bootstrap/src/dioxus.rs
@@ -1,5 +1,5 @@
use dioxus::prelude::*;
-use shield::Form;
+use shield::ActionForms;
use shield_dioxus::{DioxusStyle, ErasedDioxusStyle};
#[derive(Default)]
@@ -12,17 +12,16 @@ impl BootstrapDioxusStyle {
}
impl DioxusStyle for BootstrapDioxusStyle {
- fn render(&self, forms: &[Form]) -> Element {
+ fn render(&self, action: &ActionForms) -> Element {
rsx! {
div {
class: "container",
h1 {
- // TODO: Get from action.
- "Sign in"
+ "{action.name}"
}
- for form in forms {
+ for form in &action.forms {
form {
for input in &form.inputs {
div {
diff --git a/packages/styles/shield-bootstrap/src/leptos.rs b/packages/styles/shield-bootstrap/src/leptos.rs
new file mode 100644
index 0000000..b4b30c0
--- /dev/null
+++ b/packages/styles/shield-bootstrap/src/leptos.rs
@@ -0,0 +1,59 @@
+use leptos::prelude::*;
+use shield::{ActionForms, Input};
+use shield_leptos::{ErasedLeptosStyle, LeptosStyle};
+
+#[derive(Default)]
+pub struct BootstrapLeptosStyle {}
+
+impl BootstrapLeptosStyle {
+ pub fn context(self) -> ErasedLeptosStyle {
+ ErasedLeptosStyle::new(self)
+ }
+}
+
+impl BootstrapLeptosStyle {
+ fn render_form_input(&self, input: &Input) -> impl IntoView {
+ view! {
+
+ {self.render_label(input)}
+ {self.render_input(input)}
+
+ }
+ }
+
+ fn render_label(&self, input: &Input) -> Option {
+ input.label.as_ref().map(|label| {
+ view! {
+
+ }
+ })
+ }
+
+ fn render_input(&self, input: &Input) -> impl IntoView {
+ view! {
+
+ }
+ }
+}
+
+impl LeptosStyle for BootstrapLeptosStyle {
+ fn render(&self, action: &ActionForms) -> AnyView {
+ view! {
+
+
{action.name.clone()}
+
+ {action.forms.iter().map(|form| view! {
+
+ }).collect_view()}
+
+ }
+ .into_any()
+ }
+}
diff --git a/packages/styles/shield-bootstrap/src/lib.rs b/packages/styles/shield-bootstrap/src/lib.rs
index 33e2da1..c092ab1 100644
--- a/packages/styles/shield-bootstrap/src/lib.rs
+++ b/packages/styles/shield-bootstrap/src/lib.rs
@@ -1,5 +1,9 @@
#[cfg(feature = "dioxus")]
mod dioxus;
+#[cfg(feature = "leptos")]
+mod leptos;
#[cfg(feature = "dioxus")]
pub use dioxus::*;
+#[cfg(feature = "leptos")]
+pub use leptos::*;