dave: improve design

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2025-03-26 16:54:28 -07:00
parent f412b1ac7b
commit c6a7a50f81
7 changed files with 56 additions and 38 deletions

View File

@@ -9,6 +9,7 @@ use crate::{
use egui_winit::clipboard::Clipboard;
use nostrdb::{Filter, Transaction};
use notedeck::{MuteFun, NoteRef};
use notedeck_ui::icons::search_icon;
use std::time::{Duration, Instant};
use tracing::{error, info, warn};
@@ -220,29 +221,3 @@ fn search_box(query: &mut SearchQueryState, ui: &mut egui::Ui, clipboard: &mut C
})
.inner
}
/// Creates a magnifying glass icon widget
fn search_icon(size: f32, height: f32) -> impl egui::Widget {
move |ui: &mut egui::Ui| {
// Use the provided height parameter
let desired_size = vec2(size, height);
let (rect, response) = ui.allocate_exact_size(desired_size, egui::Sense::hover());
// Calculate center position - this ensures the icon is centered in its allocated space
let center_pos = rect.center();
let stroke = Stroke::new(1.5, Color32::from_rgb(150, 150, 150));
// Draw circle
let circle_radius = size * 0.35;
ui.painter()
.circle(center_pos, circle_radius, Color32::TRANSPARENT, stroke);
// Draw handle
let handle_start = center_pos + vec2(circle_radius * 0.7, circle_radius * 0.7);
let handle_end = handle_start + vec2(size * 0.25, size * 0.25);
ui.painter()
.line_segment([handle_start, handle_end], stroke);
response
}
}