commit 473a35cabffeade357cbd09805aecd8464021f81
parent 243eaa38aa6876bfdac0350854f1f56c97d7d25a
Author: kernelkind <kernelkind@gmail.com>
Date: Thu, 11 Dec 2025 14:52:53 -0600
refactor(nav): move chevron to notedeck_ui
Signed-off-by: kernelkind <kernelkind@gmail.com>
Diffstat:
3 files changed, 27 insertions(+), 23 deletions(-)
diff --git a/crates/notedeck_columns/src/ui/column/header.rs b/crates/notedeck_columns/src/ui/column/header.rs
@@ -9,12 +9,14 @@ use crate::{
ui::{self},
};
-use egui::{Margin, Response, RichText, Sense, Stroke, UiBuilder};
+use egui::UiBuilder;
+use egui::{Margin, Response, RichText, Sense, Stroke};
use enostr::Pubkey;
use nostrdb::{Ndb, Transaction};
use notedeck::tr;
use notedeck::{Images, Localization, MediaJobSender, NotedeckTextStyle};
use notedeck_ui::app_images;
+use notedeck_ui::header::chevron;
use notedeck_ui::{
anim::{AnimationHelper, ICON_EXPANSION_MULTIPLE},
ProfilePic,
@@ -656,28 +658,6 @@ fn prev<R>(xs: &[R]) -> Option<&R> {
xs.get(xs.len().checked_sub(2)?)
}
-fn chevron(
- ui: &mut egui::Ui,
- pad: f32,
- size: egui::Vec2,
- stroke: impl Into<Stroke>,
-) -> egui::Response {
- let (r, painter) = ui.allocate_painter(size, egui::Sense::click());
-
- let min = r.rect.min;
- let max = r.rect.max;
-
- let apex = egui::Pos2::new(min.x + pad, min.y + size.y / 2.0);
- let top = egui::Pos2::new(max.x - pad, min.y + pad);
- let bottom = egui::Pos2::new(max.x - pad, max.y - pad);
-
- let stroke = stroke.into();
- painter.line_segment([apex, top], stroke);
- painter.line_segment([apex, bottom], stroke);
-
- r
-}
-
fn grab_button() -> impl egui::Widget {
|ui: &mut egui::Ui| -> egui::Response {
let max_size = egui::vec2(20.0, 20.0);
diff --git a/crates/notedeck_ui/src/header.rs b/crates/notedeck_ui/src/header.rs
@@ -0,0 +1,23 @@
+use egui::Stroke;
+
+pub fn chevron(
+ ui: &mut egui::Ui,
+ pad: f32,
+ size: egui::Vec2,
+ stroke: impl Into<Stroke>,
+) -> egui::Response {
+ let (r, painter) = ui.allocate_painter(size, egui::Sense::click());
+
+ let min = r.rect.min;
+ let max = r.rect.max;
+
+ let apex = egui::Pos2::new(min.x + pad, min.y + size.y / 2.0);
+ let top = egui::Pos2::new(max.x - pad, min.y + pad);
+ let bottom = egui::Pos2::new(max.x - pad, max.y - pad);
+
+ let stroke = stroke.into();
+ painter.line_segment([apex, top], stroke);
+ painter.line_segment([apex, bottom], stroke);
+
+ r
+}
diff --git a/crates/notedeck_ui/src/lib.rs b/crates/notedeck_ui/src/lib.rs
@@ -5,6 +5,7 @@ pub mod constants;
pub mod contacts_list;
pub mod context_menu;
pub mod debug;
+pub mod header;
pub mod icons;
pub mod images;
pub mod media;