mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-08-01 19:38:33 +00:00
refactor(core/eckhart): unify spacing constants
[no changelog]
This commit is contained in:
parent
1711a563e6
commit
4caee20d78
@ -28,7 +28,6 @@ pub struct FidoCredential<F: FidoAccountName> {
|
||||
|
||||
impl<F: FidoAccountName> FidoCredential<F> {
|
||||
const ICON_SIZE: i16 = 32;
|
||||
const SPACING: i16 = 24;
|
||||
|
||||
pub fn new(
|
||||
icon_name: Option<TString<'static>>,
|
||||
@ -45,7 +44,7 @@ impl<F: FidoAccountName> FidoCredential<F> {
|
||||
])
|
||||
.into_paragraphs()
|
||||
.with_placement(LinearPlacement::vertical())
|
||||
.with_spacing(Self::SPACING);
|
||||
.with_spacing(theme::TEXT_VERTICAL_SPACING);
|
||||
Self {
|
||||
app_icon,
|
||||
text,
|
||||
@ -60,7 +59,8 @@ impl<F: FidoAccountName> Component for FidoCredential<F> {
|
||||
fn place(&mut self, bounds: Rect) -> Rect {
|
||||
let text_area = if let Some(app_icon) = &mut self.app_icon {
|
||||
let icon_size = app_icon.toif.size();
|
||||
let (icon_area, text_area) = bounds.split_top(icon_size.y + Self::SPACING);
|
||||
let (icon_area, text_area) =
|
||||
bounds.split_top(icon_size.y + theme::TEXT_VERTICAL_SPACING);
|
||||
app_icon.place(icon_area.with_width(icon_size.x).with_height(icon_size.y));
|
||||
text_area
|
||||
} else {
|
||||
|
@ -263,7 +263,7 @@ fn content_menu_info(
|
||||
paragraphs
|
||||
.map_or_else(ParagraphVecShort::new, |p| p)
|
||||
.into_paragraphs()
|
||||
.with_placement(LinearPlacement::vertical().with_spacing(theme::PARAGRAPHS_SPACING)),
|
||||
.with_placement(LinearPlacement::vertical().with_spacing(theme::PROP_INNER_SPACING)),
|
||||
)
|
||||
.with_header(Header::new(title).with_close_button())
|
||||
.with_subtitle(subtitle.unwrap_or(TString::empty()))
|
||||
@ -303,7 +303,7 @@ pub fn new_confirm_output(
|
||||
let content_main = TextScreen::new(
|
||||
main_paragraphs
|
||||
.into_paragraphs()
|
||||
.with_placement(LinearPlacement::vertical().with_spacing(theme::PARAGRAPHS_SPACING)),
|
||||
.with_placement(LinearPlacement::vertical().with_spacing(theme::PROP_INNER_SPACING)),
|
||||
)
|
||||
.with_header(Header::new(title.unwrap_or(TString::empty())).with_menu_button())
|
||||
.with_action_bar(ActionBar::new_single(Button::with_text(
|
||||
@ -401,7 +401,7 @@ pub fn new_confirm_output(
|
||||
// Summary
|
||||
let content_summary =
|
||||
TextScreen::new(summary_paragraphs.into_paragraphs().with_placement(
|
||||
LinearPlacement::vertical().with_spacing(theme::PARAGRAPHS_SPACING),
|
||||
LinearPlacement::vertical().with_spacing(theme::PROP_INNER_SPACING),
|
||||
))
|
||||
.with_header(
|
||||
Header::new(summary_title.unwrap_or(TR::words__title_summary.into()))
|
||||
|
@ -81,7 +81,7 @@ fn content_menu_info(
|
||||
paragraphs
|
||||
.map_or_else(ParagraphVecShort::new, |p| p)
|
||||
.into_paragraphs()
|
||||
.with_placement(LinearPlacement::vertical().with_spacing(theme::PARAGRAPHS_SPACING)),
|
||||
.with_placement(LinearPlacement::vertical().with_spacing(theme::PROP_INNER_SPACING)),
|
||||
)
|
||||
.with_header(Header::new(title).with_close_button())
|
||||
.with_subtitle(subtitle.unwrap_or(TString::empty()))
|
||||
@ -121,7 +121,7 @@ pub fn new_confirm_summary(
|
||||
let content_summary = TextScreen::new(
|
||||
summary_paragraphs
|
||||
.into_paragraphs()
|
||||
.with_placement(LinearPlacement::vertical().with_spacing(theme::PARAGRAPHS_SPACING)),
|
||||
.with_placement(LinearPlacement::vertical().with_spacing(theme::PROP_INNER_SPACING)),
|
||||
)
|
||||
.with_header(Header::new(title).with_menu_button())
|
||||
.with_action_bar(if back_button {
|
||||
|
@ -192,7 +192,7 @@ pub fn new_continue_recovery_homepage(
|
||||
pars_main
|
||||
.into_paragraphs()
|
||||
.with_placement(LinearPlacement::vertical())
|
||||
.with_spacing(24),
|
||||
.with_spacing(theme::TEXT_VERTICAL_SPACING),
|
||||
)
|
||||
.with_header(header)
|
||||
.with_action_bar(ActionBar::new_single(Button::with_text(verb.into())))
|
||||
|
@ -71,7 +71,7 @@ pub fn new_show_danger(
|
||||
Paragraph::new(&theme::TEXT_MONO_EXTRA_LIGHT, value),
|
||||
]
|
||||
.into_paragraphs()
|
||||
.with_placement(LinearPlacement::vertical().with_spacing(35));
|
||||
.with_placement(LinearPlacement::vertical().with_spacing(theme::TEXT_VERTICAL_SPACING));
|
||||
|
||||
let content_message = TextScreen::new(paragraphs)
|
||||
.with_header(
|
||||
|
@ -80,7 +80,7 @@ pub fn new_show_share_words_flow(
|
||||
instructions_paragraphs
|
||||
.unwrap_or_default()
|
||||
.into_paragraphs()
|
||||
.with_placement(LinearPlacement::vertical().with_spacing(24)),
|
||||
.with_placement(LinearPlacement::vertical().with_spacing(theme::TEXT_VERTICAL_SPACING)),
|
||||
)
|
||||
.with_header(Header::new(TR::reset__recovery_wallet_backup_title.into()))
|
||||
.with_action_bar(ActionBar::new_single(Button::with_text(
|
||||
|
@ -54,9 +54,12 @@ pub const PADDING: i16 = 24; // [px]
|
||||
pub const HEADER_HEIGHT: i16 = 96; // [px]
|
||||
pub const SIDE_INSETS: Insets = Insets::sides(PADDING);
|
||||
pub const ACTION_BAR_HEIGHT: i16 = 90; // [px]
|
||||
pub const PARAGRAPHS_SPACING: i16 = 12; // [px]
|
||||
pub const TEXT_VERTICAL_SPACING: i16 = 24; // [px]
|
||||
|
||||
// props settings
|
||||
pub const PROP_INNER_SPACING: i16 = 12; // [px]
|
||||
pub const PROPS_SPACING: i16 = 16; // [px]
|
||||
|
||||
// checklist settings
|
||||
pub const CHECKLIST_CHECK_WIDTH: i16 = 32; // [px]
|
||||
pub const CHECKLIST_SPACING: i16 = 40; // [px]
|
||||
|
@ -251,14 +251,14 @@ impl FirmwareUI for UIEckhart {
|
||||
paragraphs
|
||||
.add(
|
||||
Paragraph::new(&theme::TEXT_SMALL_LIGHT, description)
|
||||
.with_bottom_padding(theme::PARAGRAPHS_SPACING),
|
||||
.with_bottom_padding(theme::PROP_INNER_SPACING),
|
||||
)
|
||||
.add(Paragraph::new(&theme::TEXT_MONO_EXTRA_LIGHT, change).with_bottom_padding(16));
|
||||
}
|
||||
paragraphs
|
||||
.add(
|
||||
Paragraph::new(&theme::TEXT_SMALL_LIGHT, total_label)
|
||||
.with_bottom_padding(theme::PARAGRAPHS_SPACING),
|
||||
.with_bottom_padding(theme::PROP_INNER_SPACING),
|
||||
)
|
||||
.add(Paragraph::new(&theme::TEXT_MONO_EXTRA_LIGHT, total_fee_new));
|
||||
|
||||
@ -297,7 +297,7 @@ impl FirmwareUI for UIEckhart {
|
||||
|
||||
let layout = RootComponent::new(
|
||||
TextScreen::new(paragraphs.into_paragraphs().with_placement(
|
||||
LinearPlacement::vertical().with_spacing(theme::PARAGRAPHS_SPACING),
|
||||
LinearPlacement::vertical().with_spacing(theme::PROP_INNER_SPACING),
|
||||
))
|
||||
.with_header(Header::new(TR::modify_amount__title.into()))
|
||||
.with_action_bar(ActionBar::new_cancel_confirm()),
|
||||
@ -394,7 +394,7 @@ impl FirmwareUI for UIEckhart {
|
||||
title,
|
||||
None,
|
||||
paragraphs.into_paragraphs().with_placement(
|
||||
LinearPlacement::vertical().with_spacing(theme::PARAGRAPHS_SPACING),
|
||||
LinearPlacement::vertical().with_spacing(theme::PROP_INNER_SPACING),
|
||||
),
|
||||
None,
|
||||
verb,
|
||||
@ -1286,7 +1286,7 @@ impl FirmwareUI for UIEckhart {
|
||||
|
||||
let screen =
|
||||
TextScreen::new(paragraphs.into_paragraphs().with_placement(
|
||||
LinearPlacement::vertical().with_spacing(theme::PARAGRAPHS_SPACING),
|
||||
LinearPlacement::vertical().with_spacing(theme::PROP_INNER_SPACING),
|
||||
))
|
||||
.with_header(Header::new(title).with_close_button());
|
||||
let layout = RootComponent::new(screen);
|
||||
|
Loading…
Reference in New Issue
Block a user