mirror of
https://github.com/zaphar/sheetsui.git
synced 2025-07-22 13:00:22 -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,
|
||||
layout::{Constraint, Flex, Rect},
|
||||
style::{Color, Stylize},
|
||||
text::Text,
|
||||
text::{Line, Text},
|
||||
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| {
|
||||
let count = if i == 26 { 1 } else { (i / 26) + 1 };
|
||||
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 {
|
||||
Color::Rgb(57, 61, 71)
|
||||
} else {
|
||||
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)];
|
||||
col_constraints.extend(constraints.into_iter());
|
||||
|
Loading…
x
Reference in New Issue
Block a user