fixes + added button titles

This commit is contained in:
Sriram Hariharan
2023-09-17 19:38:12 -05:00
parent aea9b16f98
commit 4f170db07d
6 changed files with 31 additions and 6 deletions

View File

@@ -8,6 +8,7 @@ interface Props {
onClick?: () => void;
type?: 'primary' | 'secondary' | 'tertiary' | 'danger' | 'warning' | 'success' | 'info';
disabled?: boolean;
title?: string;
testId?: string;
}
@@ -22,6 +23,7 @@ export function Button({
testId,
children,
disabled,
title,
onClick,
}: React.PropsWithChildren<Props>): JSX.Element {
return (
@@ -31,6 +33,7 @@ export function Button({
className={classNames(styles.button, className, styles[type ?? 'primary'], {
[styles.disabled]: disabled,
})}
title={title}
onClick={disabled ? undefined : onClick}
>
{children}

View File

@@ -7,6 +7,7 @@ import styles from './Link.module.scss';
type Props = Omit<TextProps, 'span'> & {
url?: string;
disabled?: boolean;
title?: string;
};
/**

View File

@@ -11,6 +11,7 @@ export type TextProps = {
span?: boolean;
className?: string;
onClick?: () => void;
title?: string;
align?: React.CSSProperties['textAlign'];
style?: React.CSSProperties;
};
@@ -32,14 +33,14 @@ export default function Text(props: PropsWithChildren<TextProps>) {
if (props.span) {
return (
<span className={className} style={style} onClick={props.onClick}>
<span title={props.title} className={className} style={style} onClick={props.onClick}>
{props.children}
</span>
);
}
return (
<div className={className} style={style} onClick={props.onClick}>
<div title={props.title} className={className} style={style} onClick={props.onClick}>
{props.children}
</div>
);