mirror of
https://github.com/zaphar/sheetsui.git
synced 2025-07-23 05:19:48 -04:00
wip: ui: center the header lables
This commit is contained in:
parent
be4e56bba6
commit
d3d605aca9
@ -3,7 +3,7 @@ use ratatui::{
|
|||||||
buffer::Buffer,
|
buffer::Buffer,
|
||||||
layout::{Constraint, Flex, Rect},
|
layout::{Constraint, Flex, Rect},
|
||||||
style::{Color, Stylize},
|
style::{Color, Stylize},
|
||||||
text::Text,
|
text::{Line, Text},
|
||||||
widgets::{Block, Cell, Row, StatefulWidget, Table, Widget},
|
widgets::{Block, Cell, Row, StatefulWidget, Table, Widget},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -179,13 +179,14 @@ impl<'book> Viewport<'book> {
|
|||||||
header.extend((state.prev_corner.col..=end_idx).map(|i| {
|
header.extend((state.prev_corner.col..=end_idx).map(|i| {
|
||||||
let count = if i == 26 { 1 } else { (i / 26) + 1 };
|
let count = if i == 26 { 1 } else { (i / 26) + 1 };
|
||||||
let even = i % 2 == 0;
|
let even = i % 2 == 0;
|
||||||
Cell::new(COLNAMES[(i - 1) % 26].repeat(count))
|
Cell::new(Line::raw(COLNAMES[(i - 1) % 26].repeat(count)).centered())
|
||||||
.bg(if even {
|
.bg(if even {
|
||||||
Color::Rgb(57, 61, 71)
|
Color::Rgb(57, 61, 71)
|
||||||
} else {
|
} else {
|
||||||
Color::Rgb(165, 169, 160)
|
Color::Rgb(165, 169, 160)
|
||||||
})
|
})
|
||||||
.fg(if even { Color::White } else { Color::Black }).bold()
|
.fg(if even { Color::White } else { Color::Black })
|
||||||
|
.bold()
|
||||||
}));
|
}));
|
||||||
let mut col_constraints = vec![Constraint::Length(5)];
|
let mut col_constraints = vec![Constraint::Length(5)];
|
||||||
col_constraints.extend(constraints.into_iter());
|
col_constraints.extend(constraints.into_iter());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user