Refactor text style helpers

This commit is contained in:
2026-05-09 19:31:12 +08:00
parent 6eabc6a0ec
commit 9f1e051073
7 changed files with 44 additions and 58 deletions

View File

@@ -145,7 +145,7 @@ impl gpui::RenderOnce for IssueListItem {
text(self.title)
.text_sm()
.leading_tight()
.medium()
.font_weight(gpui::FontWeight::MEDIUM)
.w_full()
.min_w_0()
.line_clamp(2),

View File

@@ -117,7 +117,7 @@ impl gpui::Render for Sidebar {
.child(
text("PULL REQUESTS")
.text_xs()
.medium()
.font_weight(gpui::FontWeight::MEDIUM)
.opacity(0.5)
.pl_3()
.py_1(),

View File

@@ -275,7 +275,7 @@ impl GithubStepView {
.filter(|c| !c.is_empty())
.map(|c| {
text(String::from(c))
.bold()
.font_weight(gpui::FontWeight::BOLD)
.text_2xl()
.p_3()
.font_family("CommitMono")
@@ -333,14 +333,21 @@ impl GithubStepView {
.flex_col()
.items_center()
.gap_1p5()
.child(text("Connect to GitHub").text_xl().bold())
.child(
text("Connect to GitHub")
.text_xl()
.font_weight(gpui::FontWeight::BOLD),
)
.child(text(
if self.has_copied_code {
"You will be redirected to GitHub to authorize access.\nPaste the device code below into GitHub."
} else {
"You will be redirected to GitHub to authorize access.\nCopy the device code below into GitHub."
}
).leading_tight().centered().opacity(0.8))
)
.leading_tight()
.text_center()
.opacity(0.8))
}
}
@@ -394,11 +401,15 @@ fn connected_header() -> gpui::Div {
.flex_col()
.items_center()
.gap_1p5()
.child(text("Connected to GitHub!").text_xl().bold())
.child(
text("Connected to GitHub!")
.text_xl()
.font_weight(gpui::FontWeight::BOLD),
)
.child(
text("Novem is now connected to your GitHub account.")
.leading_tight()
.centered()
.text_center()
.opacity(0.8),
)
}
@@ -438,7 +449,12 @@ fn connected_body(user: &api::user::User, cx: &gpui::Context<GithubStepView>) ->
div()
.flex()
.flex_col()
.child(text(display_name).medium().text_xl().leading_tight())
.child(
text(display_name)
.font_weight(gpui::FontWeight::MEDIUM)
.text_xl()
.leading_tight(),
)
.child(text(user.login.clone()).text_sm().opacity(0.5)),
),
)

View File

@@ -1,4 +1,4 @@
use gpui::{AppContext, IntoElement, ParentElement, Styled, div, prelude::FluentBuilder, rems};
use gpui::{AppContext, IntoElement, ParentElement, Styled, div, prelude::FluentBuilder};
use crate::{
api, app,
@@ -109,7 +109,9 @@ impl Screen {
.child(
text(label)
.leading_tight()
.when(self.current_step == *step, |it| it.bold()),
.when(self.current_step == *step, |it| {
it.font_weight(gpui::FontWeight::BOLD)
}),
)
.when(!is_current, |it| it.opacity(0.5))
})
@@ -176,7 +178,7 @@ impl gpui::Render for Screen {
.top_20()
.left_6()
.child(font_icon(FontIcon::Cat).size_4())
.child(text("Novem").bold()),
.child(text("Novem").font_weight(gpui::FontWeight::BOLD)),
)
.child(self.step_list(cx)),
)

View File

@@ -17,7 +17,11 @@ pub(crate) fn setup_complete_step() -> impl gpui::IntoElement {
.items_center()
.justify_center()
.child(text("ദ്ദി/ᐠ - ⩊ -マ.ᐟ").text_2xl().mb_4())
.child(text("Setup complete!").bold().text_2xl())
.child(
text("Setup complete!")
.font_weight(gpui::FontWeight::BOLD)
.text_2xl(),
)
.child(text("You can now start using Novem.").opacity(0.8)),
)
.child(

View File

@@ -46,7 +46,10 @@ impl gpui::RenderOnce for WelcomeStep {
)
.opacity(0.8),
)
.child(text("Press 'Next' to begin setup.").medium()),
.child(
text("Press 'Next' to begin setup.")
.font_weight(gpui::FontWeight::MEDIUM),
),
)
.child(
div()