💄 (button): Aplica estilo deshabilitado a enlaces

Un `<a>` deshabilitado no tiene un equivalente a `:disabled` sobre el
que aplicar estilos. Button añade ahora la clase `disabled`.
This commit is contained in:
Manuel Cillero 2026-10-02 23:33:22 +02:00
parent c06efbd0d1
commit 56a2471090
3 changed files with 30 additions and 2 deletions

View file

@ -92,6 +92,12 @@ impl Component for Button {
Style::Outline(intent) => util::join!("button button-outline-", intent.color(cx)),
Style::Link => "button button-link".to_string(),
}));
// Un `<button disabled>` es deshabilitado por el navegador (`:disabled`), pero un `<a>` sin
// `href` (ver `prepare()`) no tiene un estado nativo similar. Por eso la clase `disabled`.
if *self.disabled() {
self.alter_prop(PropsOp::add_classes("disabled"));
}
}
async fn prepare(&self, cx: &mut Context) -> Result<Markup, ComponentError> {