prehnite/widget/
mod.rs

1use iced::widget::{button, space, Button};
2use iced::{padding, Element};
3use prehnite_core::font::material_symbol::CONTENT_COPY;
4use prehnite_core::font::widget::material_symbol;
5
6pub(crate) mod styles;
7
8pub fn hideable<'a, T>(element: impl Into<Element<'a, T>>, is_visible: bool) -> Element<'a, T>
9where
10    T: 'static,
11{
12    if is_visible {
13        element.into()
14    } else {
15        Element::from(space())
16    }
17}
18
19pub fn copy_button<'a, T>() -> Button<'a, T> {
20    button(material_symbol(CONTENT_COPY))
21        .padding(padding::left(1))
22        .style(button::text)
23}