refactor(a11y): update LinkButton for disabled state

This commit is contained in:
satnaing
2022-11-26 16:03:21 +06:30
parent 57c3f796d4
commit 9e92f71838
+5 -4
View File
@@ -4,19 +4,20 @@ export interface Props {
className?: string;
ariaLabel?: string;
title?: string;
tabindex?: string;
disabled?: boolean;
}
const { href, className, ariaLabel, title, tabindex } = Astro.props;
const { href, className, ariaLabel, title, disabled = false } = Astro.props;
---
<a
type="button"
href={href}
tabindex={tabindex}
href={disabled ? "#" : href}
tabindex={disabled ? "-1" : "0"}
class={`group ${className}`}
aria-label={ariaLabel}
title={title}
aria-disabled={disabled}
>
<slot />
</a>