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