we compiled
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
// src/state/pages.rs
|
||||
|
||||
pub mod form;
|
||||
pub mod auth;
|
||||
|
||||
64
client/src/state/pages/auth.rs
Normal file
64
client/src/state/pages/auth.rs
Normal file
@@ -0,0 +1,64 @@
|
||||
// src/state/pages/auth.rs
|
||||
use ratatui::{
|
||||
layout::{Alignment, Constraint, Direction, Layout, Rect},
|
||||
style::Style,
|
||||
text::{Line, Span},
|
||||
widgets::{Block, BorderType, Borders, Paragraph},
|
||||
prelude::Widget,
|
||||
Frame,
|
||||
};
|
||||
use crate::config::colors::themes::Theme;
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct AuthState {
|
||||
pub return_selected: bool,
|
||||
}
|
||||
|
||||
impl AuthState {
|
||||
pub fn render(&mut self, f: &mut Frame, area: Rect, theme: &Theme) {
|
||||
let block = Block::default()
|
||||
.borders(Borders::ALL)
|
||||
.border_type(BorderType::Rounded)
|
||||
.border_style(Style::default().fg(theme.accent))
|
||||
.style(Style::default().bg(theme.bg))
|
||||
.title(" Authentication ");
|
||||
|
||||
let inner_area = block.inner(area);
|
||||
f.render_widget(block, area);
|
||||
|
||||
let chunks = Layout::default()
|
||||
.direction(Direction::Vertical)
|
||||
.constraints([
|
||||
Constraint::Percentage(40),
|
||||
Constraint::Length(3),
|
||||
Constraint::Percentage(40),
|
||||
])
|
||||
.split(inner_area);
|
||||
|
||||
// Return button
|
||||
let button_style = if self.return_selected {
|
||||
Style::default()
|
||||
.fg(theme.highlight)
|
||||
.add_modifier(ratatui::style::Modifier::BOLD)
|
||||
} else {
|
||||
Style::default().fg(theme.fg)
|
||||
};
|
||||
|
||||
f.render_widget(
|
||||
Paragraph::new("Return to Intro")
|
||||
.style(button_style)
|
||||
.alignment(Alignment::Center)
|
||||
.block(
|
||||
Block::default()
|
||||
.borders(Borders::ALL)
|
||||
.border_type(BorderType::Plain)
|
||||
.border_style(if self.return_selected {
|
||||
Style::default().fg(theme.accent)
|
||||
} else {
|
||||
Style::default().fg(theme.border)
|
||||
}),
|
||||
),
|
||||
chunks[1]
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user