feat: pr toolbar skeleton
This commit is contained in:
@@ -7,6 +7,7 @@ use crate::{
|
||||
api::{self},
|
||||
app,
|
||||
component::{
|
||||
button::{self, Button, button},
|
||||
font_icon::{FontIcon, font_icon},
|
||||
markdown::{self, MarkdownText},
|
||||
text::text,
|
||||
@@ -20,6 +21,9 @@ pub(crate) struct PullRequestView {
|
||||
pull_request_query: Option<query::Entity<api::issues::FetchPullRequest>>,
|
||||
}
|
||||
|
||||
#[derive(gpui::IntoElement)]
|
||||
struct Toolbar {}
|
||||
|
||||
pub fn new(cx: &mut gpui::Context<PullRequestView>) -> PullRequestView {
|
||||
PullRequestView {
|
||||
markdown_viewer: None,
|
||||
@@ -198,6 +202,7 @@ impl PullRequestView {
|
||||
.flex()
|
||||
.flex_col()
|
||||
.overflow_hidden()
|
||||
.child(Toolbar {})
|
||||
.child(
|
||||
div()
|
||||
.flex()
|
||||
@@ -267,3 +272,67 @@ impl gpui::Render for PullRequestView {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl gpui::RenderOnce for Toolbar {
|
||||
fn render(self, window: &mut gpui::Window, cx: &mut gpui::App) -> impl IntoElement {
|
||||
fn toolbar_button(id: impl Into<gpui::ElementId>) -> Button {
|
||||
button(id)
|
||||
.px_2p5()
|
||||
.py_1()
|
||||
.variant(button::Variant::Secondary)
|
||||
}
|
||||
|
||||
fn divider() -> gpui::Div {
|
||||
div().h_full().w_px()
|
||||
}
|
||||
|
||||
let theme = app::current_theme(cx);
|
||||
div()
|
||||
.w_full()
|
||||
.flex()
|
||||
.flex_row()
|
||||
.items_center()
|
||||
.justify_start()
|
||||
.p_2()
|
||||
.bg(theme.colors.background)
|
||||
.border_b_1()
|
||||
.border_color(theme.colors.border)
|
||||
.child(
|
||||
toolbar_button("pr-review-btn")
|
||||
.leading(font_icon(FontIcon::Eye))
|
||||
.mr_2(),
|
||||
)
|
||||
.child(
|
||||
toolbar_button("pr-review-btn")
|
||||
.leading(font_icon(FontIcon::RefreshCw))
|
||||
.mr_2(),
|
||||
)
|
||||
.child(divider().bg(theme.colors.border).mr_2())
|
||||
.child(
|
||||
toolbar_button("pr-review-btn")
|
||||
.leading(font_icon(FontIcon::Star))
|
||||
.mr_2(),
|
||||
)
|
||||
.child(div().flex_1())
|
||||
.child(
|
||||
toolbar_button("pr-close-btn")
|
||||
.leading(font_icon(FontIcon::PullRequestClosed))
|
||||
.mr_2(),
|
||||
)
|
||||
.child(
|
||||
toolbar_button("pr-merge-btn")
|
||||
.variant(button::Variant::Primary)
|
||||
.leading(font_icon(FontIcon::GitMerge))
|
||||
.rounded_r_none(),
|
||||
)
|
||||
.child(divider())
|
||||
.child(
|
||||
toolbar_button("chevron")
|
||||
.py_1()
|
||||
.px_0p5()
|
||||
.variant(button::Variant::Primary)
|
||||
.leading(font_icon(FontIcon::ChevronDown))
|
||||
.rounded_l_none(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user