mod core;
mod dialog;
mod empty;
mod filterbar;
mod head;
mod pager;
mod rows;
mod skeleton;
mod toolbar;
mod widths;
use topcoat::{
context::Cx,
runtime::Event,
view::{Attributes, StaticClass, attributes, class},
};
use super::state::{TableSignals, query_of};
const BAR_CLASS: StaticClass =
class!("flex flex-wrap items-center gap-2 border-b border-border p-3");
const SEARCH_FORM_CLASS: StaticClass = class!("flex flex-wrap items-center gap-2");
const SEARCH_FIELD_CLASS: StaticClass = class!("relative w-full sm:w-72");
const SEARCH_ICON_CLASS: StaticClass = class!(
"pointer-events-none absolute top-1/2 left-2.5 size-4 -translate-y-1/2 text-muted-foreground"
);
pub(crate) const TABLE_CARD_CLASS: StaticClass = class!(
"overflow-hidden rounded-xl border border-border bg-card text-card-foreground shadow-sm"
);
const TABLE_BARE_CLASS: StaticClass = class!("overflow-hidden");
const QUIET_LINK_CLASS: StaticClass = class!("text-sm text-muted-foreground hover:text-foreground");
const EMPTY_LINK_CLASS: StaticClass =
class!("text-sm font-medium text-foreground underline underline-offset-4");
pub(super) fn live_link(cx: &Cx, url: String, signals: Option<&TableSignals>) -> Attributes {
match signals {
Some(signals) => {
let query = signals.query.clone();
let next = query_of(&url).to_string();
attributes! {
cx =>
href=(url)
@click=$(|e: Event| {
e.prevent_default();
query.set(next.clone());
})
}
}
None => attributes! { cx => href=(url) },
}
}