wip: connect to github
This commit is contained in:
@@ -1,47 +1,62 @@
|
||||
use gpui::{FontWeight, ParentElement, Styled, div};
|
||||
use gpui::{ParentElement, Styled, div, prelude::FluentBuilder};
|
||||
|
||||
use crate::{
|
||||
app,
|
||||
component::{button::button, text::text},
|
||||
};
|
||||
use crate::component::{button::button, text::text};
|
||||
|
||||
struct WelcomeStep {
|
||||
on_next: Option<FnOnce>,
|
||||
#[derive(gpui::IntoElement)]
|
||||
pub(crate) struct WelcomeStep {
|
||||
on_next: Option<Box<dyn Fn(&(), &mut gpui::Window, &mut gpui::App) + 'static>>,
|
||||
}
|
||||
|
||||
pub(crate) fn new<E>(cx: &gpui::Context<E>) -> impl gpui::IntoElement {
|
||||
let theme = app::current_theme(cx);
|
||||
div()
|
||||
.flex()
|
||||
.flex_col()
|
||||
.size_full()
|
||||
.items_start()
|
||||
.justify_center()
|
||||
.child(
|
||||
div()
|
||||
.flex()
|
||||
.flex_col()
|
||||
.flex_1()
|
||||
.justify_center()
|
||||
.w_full()
|
||||
.p_8()
|
||||
.child(
|
||||
text(
|
||||
"Welcome to Novem!\nThis wizard will guide you through setting up Novem.\n",
|
||||
cx,
|
||||
pub(crate) fn welcome_step() -> WelcomeStep {
|
||||
WelcomeStep { on_next: None }
|
||||
}
|
||||
|
||||
impl WelcomeStep {
|
||||
pub fn on_next(mut self, f: impl Fn(&(), &mut gpui::Window, &mut gpui::App) + 'static) -> Self {
|
||||
self.on_next = Some(Box::new(f));
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl gpui::RenderOnce for WelcomeStep {
|
||||
fn render(self, _window: &mut gpui::Window, _cx: &mut gpui::App) -> impl gpui::IntoElement {
|
||||
let next_button = button("next")
|
||||
.label("Next")
|
||||
.when(self.on_next.is_some(), |b| {
|
||||
b.on_click(move |_, window, cx| self.on_next.as_ref().unwrap()(&(), window, cx))
|
||||
});
|
||||
|
||||
div()
|
||||
.flex()
|
||||
.flex_col()
|
||||
.size_full()
|
||||
.items_start()
|
||||
.justify_center()
|
||||
.child(
|
||||
div()
|
||||
.flex()
|
||||
.flex_col()
|
||||
.flex_1()
|
||||
.justify_center()
|
||||
.w_full()
|
||||
.p_8()
|
||||
.child(
|
||||
text(
|
||||
"Welcome to Novem!\nThis wizard will guide you through setting up Novem.\n",
|
||||
)
|
||||
.opacity(0.8),
|
||||
)
|
||||
.opacity(0.8),
|
||||
)
|
||||
.child(text("Press 'Next' to begin setup.", cx).font_weight(FontWeight(500.))),
|
||||
)
|
||||
.child(
|
||||
div()
|
||||
.flex()
|
||||
.flex_row()
|
||||
.justify_end()
|
||||
.w_full()
|
||||
.p_4()
|
||||
.pt_0()
|
||||
.child(button("next", cx).label("Next")),
|
||||
)
|
||||
.child(text("Press 'Next' to begin setup.").medium()),
|
||||
)
|
||||
.child(
|
||||
div()
|
||||
.flex()
|
||||
.flex_row()
|
||||
.justify_end()
|
||||
.w_full()
|
||||
.p_4()
|
||||
.pt_0()
|
||||
.child(next_button),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user