Skip to content

Commit

Permalink
♻️ extract divider component
Browse files Browse the repository at this point in the history
  • Loading branch information
friedow committed Jul 27, 2024
1 parent e2a9625 commit be9967f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
14 changes: 14 additions & 0 deletions client/src/component/divider.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
pub fn view() -> iced::Element<'static, crate::Message> {
iced::widget::column![iced::widget::horizontal_rule(1)]
.padding(iced::Padding::from([
1. * crate::REM,
0.,
0.5 * crate::REM,
0.,
]))
// We're fixing the height here to unitfy it
// with the height of entries for a smooth
// scrolling experience
.height(crate::ENTRY_HEIGHT)
.into()
}
1 change: 1 addition & 0 deletions client/src/component/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pub mod divider;
pub mod entry;
pub mod plugin_header;
pub mod query_input;
9 changes: 3 additions & 6 deletions client/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,11 +273,7 @@ impl Application for Centerpiece {
}

if !divider_added && plugin_to_add.is_some() {
lines = lines.push(
iced::widget::column![iced::widget::horizontal_rule(1)].padding(
iced::Padding::from([1. * crate::REM, 0., 0.5 * crate::REM, 0.]),
),
);
lines = lines.push(component::divider::view());
divider_added = true;
continue;
}
Expand Down Expand Up @@ -336,7 +332,7 @@ impl Centerpiece {

let window = iced::window::Settings {
transparent: true,
size: (650, 375),
size: (650, 380),
decorations: false,
level: iced::window::Level::AlwaysOnTop,
resizable: false,
Expand Down Expand Up @@ -523,6 +519,7 @@ impl Centerpiece {
}

pub const REM: f32 = 14.0;
pub const ENTRY_HEIGHT: f32 = 2.25 * crate::REM;

struct SandboxStyle {}
impl iced::application::StyleSheet for SandboxStyle {
Expand Down

0 comments on commit be9967f

Please sign in to comment.