patternfly_yew/components/table/
cell.rs

1use super::props::TextModifier;
2use yew::prelude::*;
3
4/// A rendered cell.
5#[derive(Debug, Default)]
6pub struct Cell {
7    pub content: Html,
8    pub center: bool,
9    pub text_modifier: Option<TextModifier>,
10}
11
12impl Cell {
13    pub fn new(content: Html) -> Self {
14        Self {
15            content,
16            ..Default::default()
17        }
18    }
19
20    pub fn center(mut self) -> Self {
21        self.center = true;
22        self
23    }
24
25    pub fn text_modifier(mut self, text_modifier: impl Into<Option<TextModifier>>) -> Self {
26        self.text_modifier = text_modifier.into();
27        self
28    }
29}
30
31impl From<Html> for Cell {
32    fn from(content: Html) -> Self {
33        Cell::new(content)
34    }
35}
36
37/// The context information for rendering a cell.
38#[derive(Copy, Clone, Debug)]
39pub struct CellContext<'c, C> {
40    pub column: &'c C,
41}