Skip to content
This repository was archived by the owner on Sep 10, 2024. It is now read-only.

Commit 94f92cb

Browse files
committed
Fix the disabled state of links
1 parent 7807d20 commit 94f92cb

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

frontend/src/components/ButtonLink.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,15 @@ type Props = {
2121
size?: "sm" | "lg";
2222
Icon?: React.ComponentType<React.SVGAttributes<SVGElement>>;
2323
destructive?: boolean;
24-
};
24+
disabled?: boolean;
25+
} & React.AnchorHTMLAttributes<HTMLAnchorElement>;
2526

2627
export const ButtonLink = createLink(
2728
forwardRef<HTMLAnchorElement, PropsWithChildren<Props>>(
2829
({ children, ...props }, ref) => {
30+
const disabled = !!props.disabled || !!props["aria-disabled"] || false;
2931
return (
30-
<Button as="a" {...props} ref={ref}>
32+
<Button as="a" {...props} disabled={disabled} ref={ref}>
3133
{children}
3234
</Button>
3335
);

frontend/src/components/SessionCard/SessionCard.tsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,24 @@ export const Root: React.FC<React.PropsWithChildren> = ({ children }) => (
2626
<section className={styles.sessionCardRoot}>{children}</section>
2727
);
2828

29-
type BodyProps = React.PropsWithChildren<{
30-
disabled?: boolean;
31-
compact?: boolean;
32-
className?: string;
33-
}>;
29+
type BodyProps = React.PropsWithChildren<
30+
{
31+
disabled?: boolean;
32+
compact?: boolean;
33+
className?: string;
34+
} & React.AnchorHTMLAttributes<HTMLAnchorElement>
35+
>;
3436
export const LinkBody = createLink(
3537
forwardRef<HTMLAnchorElement, BodyProps>(
36-
({ children, disabled, compact, className, ...props }, ref) => {
38+
({ children, compact, className, ...props }, ref) => {
39+
const isDisabled = !!props.disabled || !!props["aria-disabled"] || false;
3740
return (
3841
<a
3942
className={cx(
4043
className,
4144
styles.sessionCard,
4245
compact && styles.compact,
43-
disabled && styles.disabled,
46+
isDisabled && styles.disabled,
4447
)}
4548
{...props}
4649
ref={ref}

0 commit comments

Comments
 (0)