mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-13 05:42:59 +00:00
Adjust project search landing page layout (#21332)
Closes https://github.com/zed-industries/zed/issues/21317 https://github.com/user-attachments/assets/a4970c08-9715-4c90-ad48-8f6e80c6fcd0 Release Notes: - N/A
This commit is contained in:
parent
0306bdc695
commit
69c761f5a5
1 changed files with 18 additions and 16 deletions
|
@ -333,20 +333,20 @@ impl Render for ProjectSearchView {
|
||||||
let model = self.model.read(cx);
|
let model = self.model.read(cx);
|
||||||
let has_no_results = model.no_results.unwrap_or(false);
|
let has_no_results = model.no_results.unwrap_or(false);
|
||||||
let is_search_underway = model.pending_search.is_some();
|
let is_search_underway = model.pending_search.is_some();
|
||||||
let major_text = if is_search_underway {
|
|
||||||
"Searching..."
|
let heading_text = if is_search_underway {
|
||||||
|
"Searching…"
|
||||||
} else if has_no_results {
|
} else if has_no_results {
|
||||||
"No results"
|
"No Results"
|
||||||
} else {
|
} else {
|
||||||
"Search all files"
|
"Search All Files"
|
||||||
};
|
};
|
||||||
|
|
||||||
let major_text = div()
|
let heading_text = div()
|
||||||
.justify_center()
|
.justify_center()
|
||||||
.max_w_96()
|
.child(Label::new(heading_text).size(LabelSize::Large));
|
||||||
.child(Label::new(major_text).size(LabelSize::Large));
|
|
||||||
|
|
||||||
let minor_text: Option<AnyElement> = if let Some(no_results) = model.no_results {
|
let page_content: Option<AnyElement> = if let Some(no_results) = model.no_results {
|
||||||
if model.pending_search.is_none() && no_results {
|
if model.pending_search.is_none() && no_results {
|
||||||
Some(
|
Some(
|
||||||
Label::new("No results found in this project for the provided query")
|
Label::new("No results found in this project for the provided query")
|
||||||
|
@ -359,20 +359,22 @@ impl Render for ProjectSearchView {
|
||||||
} else {
|
} else {
|
||||||
Some(self.landing_text_minor(cx).into_any_element())
|
Some(self.landing_text_minor(cx).into_any_element())
|
||||||
};
|
};
|
||||||
let minor_text = minor_text.map(|text| div().items_center().max_w_96().child(text));
|
|
||||||
|
let page_content = page_content.map(|text| div().child(text));
|
||||||
|
|
||||||
v_flex()
|
v_flex()
|
||||||
.flex_1()
|
|
||||||
.size_full()
|
.size_full()
|
||||||
|
.items_center()
|
||||||
.justify_center()
|
.justify_center()
|
||||||
|
.overflow_hidden()
|
||||||
.bg(cx.theme().colors().editor_background)
|
.bg(cx.theme().colors().editor_background)
|
||||||
.track_focus(&self.focus_handle(cx))
|
.track_focus(&self.focus_handle(cx))
|
||||||
.child(
|
.child(
|
||||||
h_flex()
|
v_flex()
|
||||||
.size_full()
|
.max_w_80()
|
||||||
.justify_center()
|
.gap_1()
|
||||||
.child(h_flex().flex_1())
|
.child(heading_text)
|
||||||
.child(v_flex().gap_1().child(major_text).children(minor_text))
|
.children(page_content),
|
||||||
.child(h_flex().flex_1()),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue