Update examples, add css

This commit is contained in:
Jonathan Kelley committed 2024-02-14 12:33:07 -08:00
1 parent 25d103c1a5
commit bdbae8ccb0
57 files changed
+964 -595

No files matched your search

+9 -2
View File
@@ -37,11 +37,16 @@ impl WebviewInstance {
dom: VirtualDom,
shared: Rc<SharedContext>,
) -> WebviewInstance {
let window = cfg.window.clone().build(&shared.target).unwrap();
let mut window = cfg.window.clone();
// tao makes small windows for some reason, make them bigger
if cfg.window.window.inner_size.is_none() {
window = window.with_inner_size(tao::dpi::LogicalSize::new(800.0, 600.0));
}
// We assume that if the icon is None in cfg, then the user just didnt set it
if cfg.window.window.window_icon.is_none() {
window.set_window_icon(Some(
window = window.with_window_icon(Some(
tao::window::Icon::from_rgba(
include_bytes!("./assets/default_icon.bin").to_vec(),
460,
@@ -51,6 +56,8 @@ impl WebviewInstance {
));
}
let window = window.build(&shared.target).unwrap();
let mut web_context = WebContext::new(cfg.data_dir.clone());
let edit_queue = EditQueue::default();
let asset_handlers = AssetHandlerRegistry::new(dom.runtime());
+8
View File
@@ -90,6 +90,14 @@ impl FormData {
self.inner.value()
}
/// Get the value of the form event as a parsed type
pub fn parsed<T>(&self) -> Result<T, T::Err>
where
T: std::str::FromStr,
{
self.value().parse()
}
/// Try to parse the value as a boolean
///
/// Returns false if the value is not a boolean, or if it is false!
+1 -1
View File
@@ -10,7 +10,7 @@ keywords = ["dom", "ui", "gui", "react"]
license = "MIT OR Apache-2.0"
[dependencies]
dioxus-desktop = { workspace = true, default-features = false, features = ["tokio_runtime"] }
dioxus-desktop = { workspace = true, features = ["tokio_runtime"] }
[lib]
doctest = false
+11
View File
@@ -99,6 +99,10 @@ pub struct LinkProps {
/// The onclick event handler.
pub onclick: Option<EventHandler<MouseEvent>>,
/// The onmounted event handler.
/// Fired when the <a> element is mounted.
pub onmounted: Option<EventHandler<MountedEvent>>,
#[props(default)]
/// Whether the default behavior should be executed if an `onclick` handler is provided.
///
@@ -269,10 +273,17 @@ pub fn Link(props: LinkProps) -> Element {
}
};
let onmounted = move |event| {
if let Some(handler) = props.onmounted.clone() {
handler.call(event);
}
};
rsx! {
a {
onclick: action,
href,
onmounted: onmounted,
prevent_default,
class,
rel,