Files
UT-Registration-Plus/src/views/components/common/Link.tsx
Aaron Park dd8187d6da style: UTRP-14: Add a bigger "hitbox" to calendar sidebar buttons (#563)
* fix(sidebar): increase sidebar button hitbox

* chore(ui): change hitbox area for plus button

* chore(ui): update size of hitbox area

* fix: fix pnpm version conflict

* fix: pnpm version conflict

* chore(ui): update size of hitbox area for the social links

* feat: calendar footer story

---------

Co-authored-by: doprz <52579214+doprz@users.noreply.github.com>
Co-authored-by: Samuel Gunter <29130894+Samathingamajig@users.noreply.github.com>
Co-authored-by: Derek <derex1987@gmail.com>
2025-11-20 13:40:17 -06:00

45 lines
1.3 KiB
TypeScript

import { background } from '@shared/messages';
import type { TextProps } from '@views/components/common/Text/Text';
import Text from '@views/components/common/Text/Text';
import clsx from 'clsx';
import type { PropsWithChildren } from 'react';
import React from 'react';
type Props = TextProps<'a'> & {
href?: string;
disabled?: boolean;
};
/**
* A reusable Text component with props that build on top of the design system for the extension
*/
export default function Link(props: PropsWithChildren<Props>): JSX.Element {
const { className, href, ...passedProps } = props;
if (href && !props.onClick) {
passedProps.onClick = e => {
e.preventDefault();
background.openNewTab({ url: href });
};
}
const isDisabled = props.disabled || (!href && !props.onClick);
return (
<Text
color='bluebonnet'
{...passedProps}
as='a'
aria-disabled={isDisabled}
href={!isDisabled ? href : undefined}
tabIndex={isDisabled ? -1 : 0}
className={clsx(
{
'underline cursor-pointer p-2': !isDisabled,
'cursor-not-allowed color-ut-gray': isDisabled,
},
className
)}
/>
);
}