mirror of
https://github.com/DioxusLabs/dioxus
synced 2025-01-20 08:44:03 +00:00
c866ae602b
* Add `#[component]` attribute + system for creating component attributes + other stuff * Delete inlineprops.rs * Update inline_props.rs * Cargo fmt * Fix clippy warnings and paths in props/mods.rs * Include where clause in `#[inline_props]` output * Allow Clippy type complexity in `LinkProps` * Allow the type complexity lint for the entire link.rs file * Remove snake_case -> PascalCase converter, but rather enforce PascalCase Also: - Put the second function inside the main one instead of besides it. - Simplify * Simplify type check lints so they don't return false positives They will not always work, but they won't return any false positives, like for aliases. This is likely going to be replaced by a more polished Clippy-backed linting system. * Fix #583 * Cargo fmt * Add docs for `deserialize()` and remove useless comment * Add `#[component]` to prelude * Merge branch 'master' of https://github.com/tigerros/dioxus * #[inline_props] is no more. Except in the docs folder, but that's going to be removed * Remove docs folder * Remove docs from workspace * Resolve `DeserializerOutput` conversation
41 lines
967 B
R
41 lines
967 B
R
use dioxus::prelude::*;
|
|
|
|
#[component]
|
|
pub fn Explainer<'a>(
|
|
cx: Scope<'a>,
|
|
invert: bool,
|
|
title: &'static str,
|
|
content: Element<'a>,
|
|
flasher: Element<'a>,
|
|
) -> Element {
|
|
// pt-5 sm:pt-24 lg:pt-24
|
|
|
|
let mut right = rsx! {
|
|
div { class: "relative w-1/2", flasher }
|
|
};
|
|
|
|
let align = match invert {
|
|
true => "mr-auto ml-16",
|
|
false => "ml-auto mr-16",
|
|
};
|
|
|
|
let mut left = rsx! {
|
|
div { class: "relative w-1/2 {align} max-w-md leading-8",
|
|
h2 { class: "mb-6 text-3xl leading-tight md:text-4xl md:leading-tight lg:text-3xl lg:leading-tight font-heading font-mono font-bold",
|
|
"{title}"
|
|
}
|
|
content
|
|
}
|
|
};
|
|
|
|
if *invert {
|
|
std::mem::swap(&mut left, &mut right);
|
|
}
|
|
|
|
cx.render(rsx! {
|
|
div { class: "flex flex-wrap items-center dark:text-white py-16 border-t font-light",
|
|
left,
|
|
right
|
|
}
|
|
})
|
|
}
|