1#![allow(missing_docs)]
2
3use gpui::Pixels;
4
5pub struct SearchInputWidth;
6
7impl SearchInputWidth {
8 /// The containzer size in which the input stops filling the whole width.
9 pub const THRESHOLD_WIDTH: f32 = 1200.0;
10
11 /// The maximum width for the search input when the container is larger than the threshold.
12 pub const MAX_WIDTH: f32 = 1200.0;
13
14 /// Calculates the actual width in pixels based on the container width.
15 pub fn calc_width(container_width: Pixels) -> Pixels {
16 if container_width.0 < Self::THRESHOLD_WIDTH {
17 container_width
18 } else {
19 Pixels(container_width.0.min(Self::MAX_WIDTH))
20 }
21 }
22}