Skip to main content

euv_ui/component/code_block/view/
struct.rs

1use super::*;
2
3/// Props for the [`euv_code_block`] component.
4///
5/// The block carries the surface it is drawn on and its size. The header,
6/// the content and the footer are passed as children.
7#[derive(Clone, CustomDebug, Default)]
8pub struct EuvCodeBlockProps {
9    /// The surface the code block is drawn on.
10    pub variant: EuvCodeBlockVariant,
11    /// The size of the block.
12    pub size: EuvCodeBlockSize,
13}
14
15/// Props for the [`euv_code_block_header`] component.
16///
17/// The header takes no settings of its own.
18#[derive(Clone, CustomDebug, Default)]
19pub struct EuvCodeBlockHeaderProps {}
20
21/// Props for the [`euv_code_block_title`] component.
22///
23/// The title takes no settings of its own.
24#[derive(Clone, CustomDebug, Default)]
25pub struct EuvCodeBlockTitleProps {}
26
27/// Props for the [`euv_code_block_actions`] component.
28///
29/// The actions take no settings of their own.
30#[derive(Clone, CustomDebug, Default)]
31pub struct EuvCodeBlockActionsProps {}
32
33/// Props for the [`euv_code_block_copy_button`] component.
34///
35/// The copy button carries the text it puts on the clipboard.
36#[derive(Clone, CustomDebug, Default)]
37pub struct EuvCodeBlockCopyButtonProps {
38    /// The text the button puts on the clipboard.
39    pub value: &'static str,
40}
41
42/// Props for the [`euv_code_block_content`] component.
43///
44/// The content carries the two settings the reference publishes: whether
45/// the long lines wrap, and whether the lines are numbered.
46#[derive(Clone, CustomDebug, Default)]
47pub struct EuvCodeBlockContentProps {
48    /// Whether a long line wraps instead of scrolling.
49    pub wrap: bool,
50    /// Whether the lines are numbered.
51    pub line_numbers: bool,
52    /// The number the first line is given.
53    pub start_line: i32,
54}
55
56/// Props for the [`euv_code_block_line`] component.
57///
58/// The line carries the state of the line inside the change the snippet
59/// shows.
60#[derive(Clone, CustomDebug, Default)]
61pub struct EuvCodeBlockLineProps {
62    /// The state of the line.
63    pub variant: EuvCodeBlockLineVariant,
64}
65
66/// Props for the [`euv_code_block_footer`] component.
67///
68/// The footer takes no settings of its own.
69#[derive(Clone, CustomDebug, Default)]
70pub struct EuvCodeBlockFooterProps {}